Why so high db hits in ProduceResults?

https://guides.neo4j.com/4.0-neo4j-modeling-exercises/03.html
In this guide I am doing this part:
PROFILE
MATCH (origin:Airport)-
[c:CONNECTED_TO]->(destination:Airport)
WHERE destination.code = 'LAS'
RETURN origin, destination, c

And I got this profile result and found 480 db hits for ProduceResults step.
Is it normal or what could cause this high db hits?
I am running EE 4.2.1 on my laptop of 16GB(10G used) RAM and 4 Cores

Curiously the other profile produced no db hit on the same laptop:

Hello @gigauser,

What you see in a profile will be dependent on:

  1. If the query was compiled (first time use).
  2. The version of the database.

The course was developed with Neo4j 4.0 so the performance and db hits may vary with a 4.2 database.

The high number of db hits is due to what is being returned. It has to return property values which require more db accesses.

Elaine

Hi Elaine,
Thank you for the advice.
I tried it several times but I got the same high hits of 480.
This is the early step of the guide with only 100 nodes.
How can it be 0 hits for 4.0 but 480 db hits for 4.2 in ProduceResults step by the same query? It looks like worse in the newer version than old version in the performance?

The ProduceResults step in the next query of this exercise (3.2) has no db hits because the where clause requires the property values for the lookup and the db hits occurs in the Projection Step. The data is in memory so it is not required for the Produce Results step.

You might want to take a look at the Query Tuning in Neo4j 4.0 to learn more about query planning and profiling queries.

Elaine

Elaine

1 Like

My question was why ProduceResults has many hits sometimes but sometimes no hit.
The ProduceResults of the first profile produce 480 hits but the second's produce no hit.

So I tried and tried with the first profile code to find which part of the code make ProduceResults step hit database. Now I found the RETURN part in the code makes the difference.

If I return as nodes then db hits occurs in ProduceResults step but if I return as properties then db hits are occurred in the Projection step(inserted) and no db hits in ProduceResult step since Projection step is requested by the return type(properties not nodes), so ProduceResult step can use the data in the memory projected by the Projection step.
Thank you for your comment. It helped me to get that point.