Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j: fastest way to find a node: by id function or index?

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
like image 241
aGO Avatar asked Jan 22 '16 09:01

aGO


1 Answers

Find by id is always faster, as it directly points to the node-record.

like image 66
Michael Hunger Avatar answered Nov 15 '22 10:11

Michael Hunger