Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-30-2020 08:32 PM
How Neo4j search data if i search nodes with the label.
If i use profile/explain the operator that shows was NodeByLabelScan.
My specific question here is, does Neo4j maintain additional storage(or any special kind of indexed data) so that, while processing query uses that data to effectively search nodes.
thanks in advance.
12-01-2020 12:44 PM
12-03-2020 05:38 AM
Thank you Clem,
On indexes i was clear that it has additional cost to maintain index data (additional memory) that helps to find/search the data.
My question is more specific to LABEL , how LABELS helps query engine to search data efficiently/quickly.
Let me rephrase the question again: On creating LABEL what all the changes(extra memory or something else created behind the scene) that helps query engine to get data quickly.
12-03-2020 05:03 PM
I'm afraid I didn't make myself clear enough.... Sorry.
There is a (hidden) collection (set) per Label of all Nodes that have that Label. (Nodes can have 0 or 1 or more Labels). When you do MATCH(n:LabelA)
, the MATCH
scans through the list of nodes that have LabelA
.
If you add LabelA
to a Node, that just means the Node gets added to the list of all nodes associated with LabelA
. Similarly if remove LabelA
from a Node, that Node gets from from the list.
Of course, this all occurs behind the scenes so you don't see it directly.
If you do MATCH(n)
that matches against all nodes, which is an expensive operation.
A similar thing occurs for Relationship Labels.
The trick is to make this as efficient as possible. One way is to keep these lists in memory so that they don't have to be fetched from disk.
There's a Neo4J video that explains this better somewhere, but I forget where.
I hope that clarifies.
12-06-2020 10:50 PM
Awesome things explained Clem!
thanks for such informative details.
All the sessions of the conference are now available online