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.

How to use precomputed custom cardinalities instead of cardinalities estimated by Neo4j in the query optimizer?

Hello,

I’d like to compare the query execution time using my custom cardinalities with that using cardinalities estimated by Neo4j's query optimizer.

I have the following plans to know the effect of cardinality estimation on the query execution time by modifying Neo4j code, but I'm not sure whether the following plans are correct or not.

  1. Given a query, precompute “custom_cardinality” for all subqueries(all possible query plans) of the given query. (Here, “custom_cardinality” can be an actual cardinality or estimate obtained by the other ways.)
  2. Modify “LogicalPlanProducer.scala” using “cardinalities.set(plan.id, custom_cardinality)” instead of “cardinalities.set(plan.id, cardinality)” (Here, custom_cardinality is precomputed in Step 1.)

I referred to the following code. (LogicalPlanProducer.scala in Neo4j-4.0)
(https://github.com/neo4j/neo4j/blob/4.0/community/cypher/cypher-planner/src/main/scala/org/neo4j/cyp...)

  1. Is it correct to compare the query execution time of the original code with the modified code as planned above?

  2. Are there any other modifications I have to consider?

  3. I’d like to know how to dump the plan using “LogicalPlan” data structure in "LogicalPlanProducer.scala".

Thanks.

0 REPLIES 0
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online