Hi all,
I am quite confused about DB hits of Neo4j.
I have 2 following queries:
Query 1:
profile match (com:Company)<-[:IS_CUSTOMER]-(cust:Customer)
with cust
return sum(cust.sysid)
Query 2:
profile match (com:Company)<-[:IS_CUSTOMER]-(cust:Customer)
with cust
with
case when cust.createdYear=2017 then cust.sysid else 0 end as year_2017,
case when cust.createdYear=2018 then cust.sysid else 0 end as year_2018,
case when cust.createdYear>2018 then cust.sysid else 0 end as current_year
return sum(year_2017) as year_2017, sum(year_2018) as year_2018, sum(current_year) as present
For query 1: there are 15 total DB hits.
For query 2: there are 27 total DB hits.
As I understand, DB hits stand for the work of storage when I try to get data from the Neo4j database. So in the case of query 2, all customer's nodes are returned and used in the second line of query. It means that data on the storage is already retrieved.
Due to the execution plan, in the projection stage, there are 16 db hits, and this point makes me confused. If all customer's nodes are already retrieved from the database, why db hits are still procedure? Those CASE statements work with the returned data only, they don't need to get data from storage then process later.