There are two options to choose from when you want to analyze a query by looking at its execution plan:
EXPLAINEXPLAIN.
The statement will always return an empty result and make no changes to the database.
PROFILEPROFILE.
This will run your statement and keep track of how many rows pass through each operator, and how much each operator needs
to interact with the storage layer to retrieve the necessary data.
Please note that profiling your query uses more resources, so you should not profile unless you are actively working on a query.
See Section 3.7, “Execution plans” for a detailed explanation of each of the operators contained in an execution plan.
|
Being explicit about what types and labels you expect relationships and nodes to have in your query helps Neo4j use the best possible statistical information, which leads to better execution plans. This means that when you know that a relationship can only be of a certain type, you should add that to the query. The same goes for labels, where declaring labels on both the start and end nodes of a relationship helps Neo4j find the best way to execute the statement. |