Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Cost planner prefers 2 NodeIndexSeek and CartesianProduct to Expand(All #12225
The cost planner fails to produce viable query plan on following query:
where there are indexes on Keyword(value) and Tweet(created_date)
Neo4j Version: 3.5.5 (both community and enterprise)
Steps to reproduce
Create indexes on
Generate some random data
Get some of the generated values, pass to followoing query
See the query profile:
It picks the wrong index to start with, fair enough. Let's provide the index hint.
Now it uses both indexes and does cartesian product, bad.
I had to resort to following to trick the planner to execute the desired query plan, note that using only
Produce the last query plan without any hints, or with
The currently generated query plan might be suitable in certain cases, it should be achievable by using 2 index hints:
@frant-hartm When looking at your plans we can see that the estimated number of rows for the NodeIndexSeekByRange over Tweet(created_date) is 0. That could indicate that the index statistics have not been updated for some reason. Could you try to add
The procedure will resample the indexes and clear query caches to make sure that the latest index statistics are used.
@Lojjs I'm investigating this at the moment. I could not find a
The issue persists. To be sure that the
I'm unable to reopen this issue on behalf of Frantisek. Let me know if you prefer a new issue, or whether you will re-open.
@luanne Thank you for trying all those things.
I am investigating this issue now, and the problem turned out to be caused by two surprising things in combination.
Also note that the
@fickludd sorry, I have a few more observations. Assuming that we did indeed have many tweets with exactly the same timestamp, providing the index hint only partially solves the issue.
So, I'd expect that the expansion happens via the single keyword to the single tweet but the plan for this query with the index hint
And now for a bit of fun ;-)
the query plan changes to