Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-01-2022 01:04 PM
Good morning,
I am creating an application in which I will have several nodes connected to a main node: to which I want to put a label: Language.
This language type node will have a field [ name: English ] and it can be activated or deactivated in the platform.
So what would be more optimal; the #node with a #label: ACTIVE for languages that are active or have a field -> [active: true/false] to denote whether it is active or not
This worries me because many queries in my api-rest will be made to this node and on several occasions it will be validated if the language is active or passive. And I would like to give you an optimal solution for query execution speed.
Cordially greetings
Solved! Go to Solution.
07-02-2022 12:22 AM
I would consider either 1) adding English as a label and status as an indexed property on the Language label or 2) both English and Active as labels.
With option 1 you can find Active English nodes with:
match(n:English:Language{status: ‘Active’})
with option 2, you can find them with:
match(n:English:Active)
One comment is that indexes on binary data, such as ‘status’, may not be greatly effective, unless there are a minority of ‘Active’ statuses. This may lead you to choosing adding Active as a label.
Do you have enough data to try each so you observe the performance differences?
07-02-2022 12:22 AM
I would consider either 1) adding English as a label and status as an indexed property on the Language label or 2) both English and Active as labels.
With option 1 you can find Active English nodes with:
match(n:English:Language{status: ‘Active’})
with option 2, you can find them with:
match(n:English:Active)
One comment is that indexes on binary data, such as ‘status’, may not be greatly effective, unless there are a minority of ‘Active’ statuses. This may lead you to choosing adding Active as a label.
Do you have enough data to try each so you observe the performance differences?
07-02-2022 05:52 AM
Thank you,
As the platform fills up with data, there will only be very few language nodes, because it has been a post platform, so if only two languages are handled, then they would be: (language,active : [name:English]) and ( language,active : [name:Spanish]) only two nodes, so seeing what you mention is better with label: active
All the sessions of the conference are now available online