Neo4j 4.0
Hi, I have a scenario which I am not sure what would be the best practice both semantically and performatically.
The scenario is the following:
We have on our database nodes that represent content. This content can have branches and leaves, which are translated via relationships and nodes. So basically a tree. Content, along everything else you can do with it can be marked as public. This makes them exposed to unauthenticated users.
In practice, if a content (top level) is marked as public, it's whole tree is traversed to mark everything in it as public as well (because the default behavior is to make everything public inside that content). The user can choose to hide some its internal parts, by making them non public.
Now, I see two ways to do this:
1 - Use labels to mark the graph nodes as public
2 - Have a boolean property to tell if the node is public or private (maybe index the property)
Now, I expect that this is something that is going to be used frequently, so if we choose label, that means we gonna see nodes constantly getting the label public or having the label public removed. What is the best strategy for this? Performance wise and scalability wise. I read the docs on the costs of each and I know property set is roughly double of label set, memory allocation wise. But that's it, still need more info.
I fear the following:
-
Using labels may affect index performance and storage size negatively. Since I don't know how index fragmentation is handled in neo4j 4, it could be a bad idea to use labels for this case. I don't want to have to worry about rebuilding indexes.
-
Enter some performance bottlenecks due to locking.
-
If I choose to use property indexing, how different would it be from label indexing.
I am still not confident what is the most semantically correct choice, regardless of database I/O implications. What do you guys think?
Thanks for the help.