Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit of labels on a node in Neo4j

Is there a limit on the number of labels you can put on nodes in Neo4j? Also what are the ramifications of lots of labels on the performance of inserts? Thanks

like image 647
joe Avatar asked Dec 25 '22 15:12

joe


1 Answers

In theory the number of labels is almost unlimited (not sure but I think it was Integer.MAX_VALUE). In practice you should have as few labels as reasonable on a single node. The first 4-5 (don't remember the exact number) labels are stored directly with the node. The remaining labels are stored in a different location internally. So reading a node having more than 4-5 labels might result in another IO operation.

Upon a write operation every labels will cause extra burden since labels are self-indexing and therefore Neo4j needs to write to the labelscanstore for that label.

Most graphs I've seen so far (and that's quire a few ;-) ) don't have more than 3 labels on a single node.

like image 51
Stefan Armbruster Avatar answered Dec 28 '22 06:12

Stefan Armbruster