cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Query execute time varies

Hello
As part of my work i'm examining queries runtime (with PROFILE)
I have notices that running the same query may return varied results.
For example the following query:
<profile Match (p1:Person)-[:Participant]-(w) Where p1.name = 'Ellen Pompeo' Return w>

returned the following times (db hits + plan remained the same): 390ms, 65ms, 16ms, 26ms
I know the changes are rather small but since time is cruicle for my research i would like to know the reasons why this may occur
I am using neo4j desktop 1.2.9, database neo4j 4.0.4

tnx! Noa

2 REPLIES 2

The first time executing will nearly always take the longest, since there's often pagecache misses that need to be dealt with. Subsequent runs should be using the pagecache and should be faster.

Beyond that, remember that you're at the mercy of the OS which is running other apps besides Neo4j Desktop, there are likely many processes competing for CPU scheduling. It's likely you'll see timings in the same order of magnitude, but in a busy system (and not a dedicated server only running Neo4j) you may not see even consistency in the timings.

Tnx! Thought it has something to do with first execution vs. following executions.
It helps a lot knowing this!