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.

If the same cypher phase is repeatedly executed in a short time, is it possible to be retrieved data from memory?

In the case of RDBMS, when repeatedly executing the same data query within a short period of time, a lot of data is stored in memory, so there are in which faster results can be obtained than the first time query.
Does NEO4J operate with the same structure as RDBMS?
If so, is there a way to check it through PROFILE ?

2 REPLIES 2

Hi @haidkang ,

There are a few aspects to consider for repeated queries:

  1. Query planning - a query gets parsed, then an execution plan is determined. A query that is exactly the same will re-use the existing plan, unless replanning is triggered.
  2. Query parameterization - a query that is mostly the same but differs in use of literal values is effectively a different query and must be re-parsed and re-planned. Using query parameters mitigates this problem
  3. Cluster member variance. While all members of a cluster will have a replica of the data on disk, their in-memory caches may differ. That could be an advantage if, for example, you have regional based read-replicas that would have different parts of the graph in their cache. But if you send the same query to different members of the cluster, their will be variety in what parts of the graph have been cached, so execution time may be different.

Could you explain some more about "operate with the same structure as RDBMS"? Neo4j has similarities and differences. Do you have something particular in mind?

About PROFILE, yes you can prepend any query with either PROFILE to see the query plan and costs. You can also use EXPLAIN to see the plan without executing the query (which is helpful when query execution is long and you just want to optimize a particular query before running it).

Best,
ABK

Thanks for your kind explanation.