When using PROFILE, should we optimize db hits or time in ms of the first time run?

Hello,

I am trying to optimize a query for bulk loads and I have four options which returned the following db.hits and time in ms

Option 1: 8760 total db hits in 1 ms
Option 2: 8760 total db hits in 16 ms
Option 3: 8598 total db hits in 32 ms
Option4: 7364 total db hits in 47 ms

I am not sure if I can post the original query since this is a client work. However, I would like to have a guideline on which query to pick. As I go down the list, the readability of the code gets a bit involved but the first time run for each of the query that returns identical results of 617 records increases.

Kindly let me know.

Thanks,
Lavanya

@lavanya.kannan1

isnt the end all be all, how long did it take my cypher to produce a result and thus I would go with Option 1 above. if for example you went with Option 4 since it has the fewest db hits, but yet takes the longest does the end user think 'oh this is good so few db hits'? Does the user running 'Option 1` think only.. wow that was super fast

1 Like

@dana_canzano I think this is a case when storing some results from intermediate step is warranted. Ideally, when we optimize the cypher code, I think it is best to optimize both dbhits and time - if this is not possible, may be we could do better - in my case, it was by storing data from intermediate step.

Also, these options ran almost the same time for atomic queries that is set to return only one row. Just to give additional background, the query had two MATCH queries which were identical; but an aggregating step in the middle. That's why I think it is better to divide this query into two and store and use the results from the first query in the second.