New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opt: choosing worse plans with stats present on TPC-H queries than without stats #46701
Comments
Q18: The |
Q5: This is due to our |
Q6: The stats are quite accurate on this one (estimate=938K rows, actual=909K rows). This means it's the coster that's at fault. In particular, it appears that |
Note that all queries (except for Q20) were run with |
Q11: Again, the stats are quite accurate on this one (estimate=32,258 rows, actual=31,680 rows). This is another case where the primary index scan is now faster, but the coster was not updated to reflect that. |
Actually Radu already took a deeper look at Q6 in #46677. |
OK, then it's a problem with the coster, even without vectorized=off. Sounds like Radu's working theory is that it's due to mis-costing on tables with many columns, which seems plausible to me. |
Both Q6 & Q11 are the same issue: using a secondary index + index-join vs. using a primary index. |
Q12: Looks like similar issue to Q6 and Q11 - mis-costing of secondary index + index-join vs. primary index. |
Q20: Same as Q12, Q6, and Q11. |
In summary: |
Thanks for doing this analysis, @andy-kimball! |
Has the recent TPC-H testing changed the status of this issue? |
I no longer see "no stats" case being faster on Q5, Q11, Q18, and Q20. Q12
We also seem to have regressed on query 20 (in absolute terms, not in "no stats" vs "with stats" comparison).
|
I looked over a recent run of
|
+@DrewKimball, who can provide insight into what's causing these issues. Some of these TPC-H queries are deliberately built to fool standard stats algorithms. |
Poor plan-choosing for Q7 is tracked in #52159. It looks to be due to mis-costing, since stats are actually pretty accurate. |
We have marked this issue as stale because it has been inactive for |
After encountering a suboptimal plan for query 6 (as described in #46677), I decided to run all TPC-H queries without automatic stats present and with automatic stats present. All queries ran on a single node cluster on my laptop. I extracted all queries for which the runtimes seem to significantly increase once statistics are collected on tables.
Without stats:
With stats:
Without stats:
With stats:
Without stats:
With stats:
Without stats:
With stats:
Without stats:
With stats:
vectorize=on
)Without stats:
With stats:
Jira issue: CRDB-5065
The text was updated successfully, but these errors were encountered: