Best practices on number of properties for a node

(Dmellonielet) #1

Hello,

Is there a restriction on the number of properties we can have for a given node?

0 Likes

(Andrew Bowman) #2

I'm not aware of any hard restrictions, however any specific property access must linearly iterate over the properties of the node/rel until the correct property key is found.

For queries that must filter by property or otherwise perform specific property lookup, when the number of nodes to consider during the execution of the query is high and the number of properties on nodes is high, you may see this affect execution time.

0 Likes

(M. David Allen) #3

Seconding @andrew.bowman there isn't a hard limit. HOWEVER -- creating an overly large number of properties on a node is not a good idea for several reasons -- Andrew gave one affecting execution time.

If a node has a large (say, > 12) number of properties, it's common to see that a modeling error somewhere else has been made. For example, imagine a Car node like this:

(:Car {
   color: 'red',
   make: 'Toyota',
   model: 'Camry',
   year: '2017',
   stereo: 'premium'
   (40 other properties about car features)
})

In this case the user will think they need lots of properties to capture all of this data, and they do need to capture that data -- but excessive properties are defeating the graph model and they might be better off factoring those properties out into separate nodes via relationships.

3 Likes