Query Tuning
Till now, we have looked at various aspects of building Cypher queries. In this chapter, we will take a look at which options are available to profile and tune queries.
We have two options available to tune queries. The first one is the EXPLAIN
clause, which takes the Cypher query and provides an estimated amount of work the database might do. It does not execute the query. The other one is the PROFILE
clause. This will execute the query and gives the exact amount of work the database is doing. We will review both of these options in detail to understand how to leverage them to tune queries.
We will be taking a look at these aspects:
- Working with
EXPLAIN
- Working with
PROFILE
- Reviewing plan operators
- Using index hints
First, let’s take a look at how to use EXPLAIN
to tune queries.