Is it faster find a node by id function
MATCH (i:Item) WHERE id(i) = 2345 RETURN i
or by a property indexed?
MATCH (i:Item { name: "Foo"}) RETURN i
Profiling these queries I saw
- id function: 2 total db hits
- index: 1 total db hits
Is it faster find a node by id function
MATCH (i:Item) WHERE id(i) = 2345 RETURN i
or by a property indexed?
MATCH (i:Item { name: "Foo"}) RETURN i
Profiling these queries I saw
Find by id is always faster, as it directly points to the node-record.
Faster to search nodes by id. The function id() is deprecated. Use the function elementId() instead.
© 2022 - 2025 — McMap. All rights reserved.
ID()
can be recycled, so if you store it as a reference somewhere else the reference might be orphaned – LegroomMATCH (i) WHERE id(i) = 2345 RETURN i
(i.e. drop the label on(i:Item)
it would be a single db hit too. It has the effect of removing the Filter step after the NodeByIdSeek step. – Gombach