forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit297b280

Richard Guo
Ignore nullingrels when looking up statistics
When looking up statistical data about an expression, we do not needto concern ourselves with the outer joins that could null theVars/PHVs contained in the expression. Accounting for nullingrels inthe expression could cause estimate_num_groups to count the same Varmultiple times if it's marked with different nullingrels. This isincorrect, and could lead to "ERROR: corrupt MVNDistinct entry" whensearching for multivariate n-distinct.Furthermore, the nullingrels could prevent us from matching anexpression to expressional index columns or to the expressions inextended statistics, leading to inaccurate estimates.To fix, strip out all the nullingrels from the expression before welook up statistical data about it. There is one ensuing plan changein the regression tests, but it looks reasonable and does notcompromise its original purpose.This patch could result in plan changes, but it fixes an actual bug,so back-patch to v16 where the outer-join-aware-Var infrastructure wasintroduced.Author: Richard GuoDiscussion:https://postgr.es/m/CAMbWs4-2Z4k+nFTiZe0Qbu5n8juUWenDAtMzi98bAZQtwHx0-w@mail.gmail.com1 parent7596207 commit297b280
File tree
3 files changed
+63
-5
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+63
-5
lines changedLines changed: 26 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
| 124 | + | |
124 | 125 |
| |
125 | 126 |
| |
126 | 127 |
| |
| |||
3306 | 3307 |
| |
3307 | 3308 |
| |
3308 | 3309 |
| |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
3309 | 3319 |
| |
3310 | 3320 |
| |
3311 | 3321 |
| |
| |||
5017 | 5027 |
| |
5018 | 5028 |
| |
5019 | 5029 |
| |
| 5030 | + | |
5020 | 5031 |
| |
5021 | 5032 |
| |
5022 | 5033 |
| |
| |||
5058 | 5069 |
| |
5059 | 5070 |
| |
5060 | 5071 |
| |
| 5072 | + | |
5061 | 5073 |
| |
5062 | 5074 |
| |
5063 | 5075 |
| |
5064 |
| - | |
| 5076 | + | |
5065 | 5077 |
| |
5066 | 5078 |
| |
5067 | 5079 |
| |
5068 | 5080 |
| |
5069 | 5081 |
| |
5070 | 5082 |
| |
5071 | 5083 |
| |
5072 |
| - | |
| 5084 | + | |
| 5085 | + | |
5073 | 5086 |
| |
5074 | 5087 |
| |
5075 | 5088 |
| |
| |||
5099 | 5112 |
| |
5100 | 5113 |
| |
5101 | 5114 |
| |
5102 |
| - | |
| 5115 | + | |
5103 | 5116 |
| |
5104 | 5117 |
| |
5105 | 5118 |
| |
| |||
5124 | 5137 |
| |
5125 | 5138 |
| |
5126 | 5139 |
| |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
5127 | 5148 |
| |
5128 | 5149 |
| |
5129 | 5150 |
| |
| |||
5394 | 5415 |
| |
5395 | 5416 |
| |
5396 | 5417 |
| |
| 5418 | + | |
| 5419 | + | |
5397 | 5420 |
| |
5398 | 5421 |
| |
5399 | 5422 |
| |
|
Lines changed: 24 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2517 | 2517 |
| |
2518 | 2518 |
| |
2519 | 2519 |
| |
2520 |
| - | |
| 2520 | + | |
| 2521 | + | |
2521 | 2522 |
| |
2522 | 2523 |
| |
2523 |
| - | |
| 2524 | + | |
2524 | 2525 |
| |
2525 | 2526 |
| |
2526 | 2527 |
| |
| |||
8014 | 8015 |
| |
8015 | 8016 |
| |
8016 | 8017 |
| |
| 8018 | + | |
| 8019 | + | |
| 8020 | + | |
| 8021 | + | |
| 8022 | + | |
| 8023 | + | |
| 8024 | + | |
| 8025 | + | |
| 8026 | + | |
| 8027 | + | |
| 8028 | + | |
| 8029 | + | |
| 8030 | + | |
| 8031 | + | |
| 8032 | + | |
| 8033 | + | |
| 8034 | + | |
| 8035 | + | |
| 8036 | + | |
| 8037 | + | |
| 8038 | + |
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2952 | 2952 |
| |
2953 | 2953 |
| |
2954 | 2954 |
| |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + |
0 commit comments
Comments
(0)