Working with PROFILE
The PROFILE
clause executes as per the plan created by the database and provides the exact cost of the query. It will keep track of how many rows pass through the operators and the amount of work the database is doing that is measured as database hits.
Let’s look at a basic example and compare the EXPLAIN
and PROFILE
plans:
PROFILE MATCH (d {code:'313820'}) RETURN d
In the query, we can see that the only difference is we are using PROFILE
instead of EXPLAIN
:
Figure 9.6 – Basic query without EXPLAIN and PROFILE label comparison
We can see that the plan remained exactly the same, but we are seeing the db hits, which are the measurement of how much work the database is doing. You can think of 1
db hit as a unit of work the database is doing. More db hits mean a plan step is taking more work than the database is doing to complete that step in the query. Also, more db hits mean that it’s taking more time...