Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-31-2020 05:26 PM
To all the Graph enthusiasts,
Is there a way to speed up initial node location without using labels?
Hoping answer to my question.
Thanks in advance
Solved! Go to Solution.
01-31-2020 05:31 PM
Are you referring to the speed of looking up a node?
If you know the node's graph id, then you can look it up without knowing it's label:
MATCH (n)
WHERE id(n) = 12345
...
In the query plan you should see a NodeByIdSeek.
However these kinds of lookups tend to be rare, since you will rarely know the id of a node to lookup. And since ids of nodes and relationships can be reused (after deletion of the node or relationship), if you keep the ids outside of the database for later lookup, but don't keep it in sync with those deletions, then it could mean that a node lookup will instead get you a completely different node (since the one you wanted was previously deleted) or no node at all.
Otherwise, you'll need an index lookup, and all index lookups require that the node is labeled, and that the label of the index is present in the pattern used to find the node.
01-31-2020 05:31 PM
Are you referring to the speed of looking up a node?
If you know the node's graph id, then you can look it up without knowing it's label:
MATCH (n)
WHERE id(n) = 12345
...
In the query plan you should see a NodeByIdSeek.
However these kinds of lookups tend to be rare, since you will rarely know the id of a node to lookup. And since ids of nodes and relationships can be reused (after deletion of the node or relationship), if you keep the ids outside of the database for later lookup, but don't keep it in sync with those deletions, then it could mean that a node lookup will instead get you a completely different node (since the one you wanted was previously deleted) or no node at all.
Otherwise, you'll need an index lookup, and all index lookups require that the node is labeled, and that the label of the index is present in the pattern used to find the node.
02-02-2020 09:26 AM
Thanks for the help.
All the sessions of the conference are now available online