forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit042c909
committed
Produce more-optimal plans for bitmap scans on boolean columns.
The planner simplifies boolean comparisons such as "x = true" and"x = false" down to "x" and "NOT x" respectively, to have a canonicalform to ease comparisons. However, if we want to use an index on x,the index AM APIs require us to reconstitute the comparison-operatorform of the indexqual. While that works, in bitmap indexscans thecanonical form of the qual was emitted as a "filter" conditionalthough it really only needs to be a "recheck" condition, becausecreate_bitmap_scan_plan didn't recognize the equivalence of thatform with the generated indexqual. booleq() is pretty cheap so thatlikely doesn't make very much difference, but it's unsightly solet's clean it up.To fix, add a case to predicate_implied_by() to recognize theequivalence of such clauses. This is a relatively low-cost place toadd a check, and perhaps it will have additional use cases in future.Richard Guo and Tom Lane, per discussion of bug #17618 from SindySenorita.Discussion:https://postgr.es/m/17618-7a2240bfaa7e84ae@postgresql.org1 parent05a7be9 commit042c909
File tree
3 files changed
+60
-2
lines changed- contrib/btree_gin
- expected
- sql
- src/backend/optimizer/util
3 files changed
+60
-2
lines changedLines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
95 |
| - | |
| 95 | + | |
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + |
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| 28 | + | |
| 29 | + |
Lines changed: 45 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
| |||
1093 | 1094 |
| |
1094 | 1095 |
| |
1095 | 1096 |
| |
1096 |
| - | |
| 1097 | + | |
1097 | 1098 |
| |
1098 | 1099 |
| |
1099 | 1100 |
| |
1100 | 1101 |
| |
1101 | 1102 |
| |
1102 | 1103 |
| |
1103 | 1104 |
| |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1104 | 1111 |
| |
1105 | 1112 |
| |
1106 | 1113 |
| |
| |||
1124 | 1131 |
| |
1125 | 1132 |
| |
1126 | 1133 |
| |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
1127 | 1171 |
| |
1128 | 1172 |
| |
1129 | 1173 |
| |
|
0 commit comments
Comments
(0)