You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Re-land Decimal filter selectivity estimation (#25790) without the TPC-H Q18 regression #27146
Is your feature request related to a problem or challenge?
#25790 added interval analysis to estimate filter selectivity on Decimal columns. On TPC-H Q18 this change made the plan use a much worse join order: the query took about 233 s and 22 GB of peak memory, compared with about 7 s and 4 GB before (#27108). #27145 reverts the change for the 56 release.
Describe the solution you'd like
Find out why the new estimate changes the Q18 join order. Then re-land #25790 with a TPC-H Q18 plan check, so that this regression cannot return.
sorry, I looked into it and reproduced it locally.
in Q18, HAVING sum(l_quantity) > 300 filters the output of an aggregate, so the sum column has no min/max stats. before my PR, decimals weren't supported, so this filter got the default 20% (the ~120M rows in the 55.1 plan). now it goes through interval analysis, but with no bounds it estimates 100%, so 600M rows. that makes it look like the biggest input, and the semi join builds on the wrong side.
I mentioned this "no stats means 100%" case in the PR description but didn't think about aggregate outputs. I reproduced it at SF1: the join flips and peak memory goes from ~430 MB to ~1.25 GB.
for the re-land, I'll keep the default selectivity when a decimal column has no min/max stats, and add a Q18 plan test so this can't come back. i've tested that locally: Q18 gets its old plan back and the Q6 improvement stays.
sorry, I looked into it and reproduced it locally.
in Q18, HAVING sum(l_quantity) > 300 filters the output of an aggregate, so the sum column has no min/max stats. before my PR, decimals weren't supported, so this filter got the default 20% (the ~120M rows in the 55.1 plan). now it goes through interval analysis, but with no bounds it estimates 100%, so 600M rows. that makes it look like the biggest input, and the semi join builds on the wrong side.
I mentioned this "no stats means 100%" case in the PR description but didn't think about aggregate outputs. I reproduced it at SF1: the join flips and peak memory goes from ~430 MB to ~1.25 GB.
for the re-land, I'll keep the default selectivity when a decimal column has no min/max stats, and add a Q18 plan test so this can't come back. i've tested that locally: Q18 gets its old plan back and the Q6 improvement stays.
I took a cursory look when the error was reported and came to the same conclusion and what you propose is a reasonable fix for the degenerate cases with no bounds, happy to take a look when ready to get it to a reviewable state for maintainers to approve (FYI I will be mostly off next week with limited connectivity, fully back after that). Thanks for taking a look that quickly, @shrivasshankar!
sorry, I looked into it and reproduced it locally.
in Q18, HAVING sum(l_quantity) > 300 filters the output of an aggregate, so the sum column has no min/max stats. before my PR, decimals weren't supported, so this filter got the default 20% (the ~120M rows in the 55.1 plan). now it goes through interval analysis, but with no bounds it estimates 100%, so 600M rows. that makes it look like the biggest input, and the semi join builds on the wrong side.
I mentioned this "no stats means 100%" case in the PR description but didn't think about aggregate outputs. I reproduced it at SF1: the join flips and peak memory goes from ~430 MB to ~1.25 GB.
for the re-land, I'll keep the default selectivity when a decimal column has no min/max stats, and add a Q18 plan test so this can't come back. i've tested that locally: Q18 gets its old plan back and the Q6 improvement stays.
I took a cursory look when the error was reported and came to the same conclusion and what you propose is a reasonable fix for the degenerate cases with no bounds, happy to take a look when ready to get it to a reviewable state for maintainers to approve (FYI I will be mostly off next week with limited connectivity, fully back after that). Thanks for taking a look that quickly, @shrivasshankar!
Activity
shrivasshankar commentedon Nov 5, 2026
take
shrivasshankar commentedon Nov 5, 2026
sorry, I looked into it and reproduced it locally.
in Q18, HAVING sum(l_quantity) > 300 filters the output of an aggregate, so the sum column has no min/max stats. before my PR, decimals weren't supported, so this filter got the default 20% (the ~120M rows in the 55.1 plan). now it goes through interval analysis, but with no bounds it estimates 100%, so 600M rows. that makes it look like the biggest input, and the semi join builds on the wrong side.
I mentioned this "no stats means 100%" case in the PR description but didn't think about aggregate outputs. I reproduced it at SF1: the join flips and peak memory goes from ~430 MB to ~1.25 GB.
for the re-land, I'll keep the default selectivity when a decimal column has no min/max stats, and add a Q18 plan test so this can't come back. i've tested that locally: Q18 gets its old plan back and the Q6 improvement stays.
Revert apache#25790 (Decimal filter selectivity) due to TPC-H Q18 reg…
asolimando commentedon Nov 6, 2026
I took a cursory look when the error was reported and came to the same conclusion and what you propose is a reasonable fix for the degenerate cases with no bounds, happy to take a look when ready to get it to a reviewable state for maintainers to approve (FYI I will be mostly off next week with limited connectivity, fully back after that). Thanks for taking a look that quickly, @shrivasshankar!
shrivasshankar commentedon Nov 6, 2026
Thanks! It’s ready for review in #27148 no rush.