Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-01-2020 05:04 PM
Hi, I am new to neo4j and have some questions
I am evaluating the query performance under different join orders (query is written in Cypher)
According to Neo4j manual, I can input several hints such as index, scan, and join hints.
https://neo4j.com/docs/cypher-manual/current/query-tuning/using/#query-using-join-hint
Index hints are used to specify the starting nodes for joins.
Join hints are used to specify the joining nodes for joins.
However, there seems to be no way to force certain join orders.
For example, say a query Q is given as follow:
v1 -- v2 -- v3
........ |
....... v4 -- v5
How can I evaluate the query performance for different join orders such as:
(1) (v1, v2, v3, v4, v5)
(2) (v1, v2, v4, v5, v3)
(3) (v2, v3, v4, v5, v1)
...
Currently, using the index and join hints, I can only make certain join orders (Not all of possible orders)
Is there any way to achieve it?
(In Oracle DB, it is achieved by using ORDERED)
Thanks for your attention,
12-08-2021 10:18 PM
There is no direct way to do that. It is also usually not a good idea to force the planner onto expensive paths.
you could split your patterns into smaller MATCH patterns, reorder them in your query and then add a WITH * WHERE 1+1=2 (or some expression that can not be easily removed) to disable reordering/with removal.
12-08-2021 11:26 PM
For research purposes I think there should be a switch that does it. With enough experience, one can beat the cost model, whose score doesn't always point towards lower exec time...
All the sessions of the conference are now available online