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.
- 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.)
- 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)
Is it correct to compare the query execution time of the original code with the modified code as planned above?
Are there any other modifications I have to consider?
I’d like to know how to dump the plan using “LogicalPlan” data structure in "LogicalPlanProducer.scala".