Explain and profile instructions
Explain and profile are the two Cypher instructions that will help us get facts where we see possible performance issues.
Explain will give you the execution plan of your query without executing it, while profile will execute the query and return results.
The execution plan is not determined by a hitman but out of the text defining the query by a component of Cypher named the planner; there are two planners: cost planner and rule planner. Cost planner is used by default; it appeared in version 2.2. Its action is to smoothly turn a text into a list of operators (remember this name).
A query plan
To illustrate, here is an example of a query plan, which reads from top to bottom. You can see the related query in the image; it is based on the Movies
dataset that is available if you follow the slides tied to the :play movies
command:
A short execution plan
The first operator is NodeByLabelScan
because I mentioned the labels. If I drop them, the execution plan becomes...