Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Neo4j Cypher Profile keyword and execution plan

Tags:

neo4j

cypher

Could someone please explain or provide links where we can learn about the profile command and understand the execution plans of Cypher query for optimization needs and understanding how Cypher works.

For example, I created the following Neo4j(version 2.0) sample database.

create (ayan:Person{name:"Ayan",age:25}), 
(dixi:Person{name:"Dixi",age:26}), 
(thaggu:Person{name:"Thaggu",age:27}), 
(santosh:Person{name:"Santosh",age:28}),
(ayan)-[:FRIEND]-(santosh),
(ayan)-[:FRIEND]-(dixi),
(thaggu)-[:FRIEND]-(dixi);

Now,when i run the simple query below,

profile match n:Person, n-[:FRIEND]-m where n.name="Ayan" return m;

I get the following result, but I am not able to understand the explaination below the result. Please help.

+--------------------------------+
| m                              |
+--------------------------------+
| Node[4]{age:28,name:"Santosh"} |
| Node[2]{age:26,name:"Dixi"}    |
+--------------------------------+
2 rows



==> ColumnFilter(symKeys=["n", "m", "  UNNAMED17"], returnItemNames=["m"], _rows=2, _db_hits=0)

==> PatternMatch(g="(m)-['  UNNAMED17']-(n)", _rows=2, _db_hits=0)

==>   Filter(pred="(Property == Literal(Ayan) AND hasLabel(n: Person))", _rows=1, _db_hits=4)

==>     NodeByLabel(label="Person", identifier="n", _rows=4, _db_hits=0)
like image 566
ayan_2587 Avatar asked Jul 20 '13 09:07

ayan_2587


1 Answers

the profile information is right now not finished yet and therefore not documented. However, the critical number are the _db_hits that should not be exceptionally high since they are expensive.

like image 168
Peter Neubauer Avatar answered Oct 06 '22 00:10

Peter Neubauer