cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Doubt in architecture of my database

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

I love neo4j because I feel connected!!!
1 ACCEPTED SOLUTION

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? 

View solution in original post

2 REPLIES 2

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? 

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

I love neo4j because I feel connected!!!