Properties vs Labels ... (Newbie question)

354 views
Skip to first unread message

David Rader

unread,
Dec 12, 2016, 10:47:30 AM12/12/16
to Neo4j
What are the advantages/disadvantages of using properties vs labels as classifiers?  
I currently have a "type" property in some nodes. Wondering if the general rule should be using labels instead.

An example:
Have nodes labeled CONTACT for holding email, phones, IM, etc. One node for each identity (number, address, etc).
Could have a set of T/F roles for home, work, mobile, preferred, other since any contact could serve multiple roles.
Is it better to have a set of role properties or assign labels?  The property could later be expanded from T/F to days/hours of availability. The label couldn't be expanded.

thanks,
Dave

Michael Hunger

unread,
Dec 12, 2016, 11:41:17 AM12/12/16
to ne...@googlegroups.com
Hi Dave,

labels are stored and queried quite efficiently as they are part of the node-record.

Properties are stored separatedly in property-records via an indirection and are also compressed, so that that they have to be unserialized on access. 

So if you have a fact / class / tag / boolean value that makes sense to encode as label, then the label will be faster to query.

In your example I would add multiple labels, :Contact:Phone:Fax if you need that information upfront, if you don't need it upfront you can just access the appropriate property which would be null in that case.

Cheers, Michael



--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Rader

unread,
Dec 12, 2016, 12:05:08 PM12/12/16
to Neo4j
Excellent insight.  Very helpful.  Thanks
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages