forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitff720a5
committed
Fix planner to consider matches to boolean columns in extension indexes.
The planner has to special-case indexes on boolean columns, becausewhat we need for an indexscan on such a column is a qual of the shapeof "boolvar = pseudoconstant". For plain bool constants, previoussimplification will have reduced this to "boolvar" or "NOT boolvar",and we have to reverse that if we want to make an indexqual. There isexisting code to do so, but it only fires when the index's opfamilyis BOOL_BTREE_FAM_OID or BOOL_HASH_FAM_OID. Thus extension AMs, orextension opclasses such as contrib/btree_gin, are out in the cold.The reason for hard-wiring the set of relevant opfamilies was mostlyto avoid a catalog lookup in a hot code path. We can improve matterswhile not taking much of a performance hit by relying on thehard-wired set when the opfamily OID is visibly built-in, and onlychecking the catalogs when dealing with an extension opfamily.While here, rename IsBooleanOpfamily to IsBuiltinBooleanOpfamilyto remind future users of that macro of its limitations. At somepoint we might want to make indxpath.c's improved version of thetest globally accessible, but it's not presently needed elsewhere.Zongliang Quan and Tom LaneDiscussion:https://postgr.es/m/f293b91d-1d46-d386-b6bb-4b06ff5c667b@yeah.net1 parentd885a6b commitff720a5
File tree
6 files changed
+40
-10
lines changed- contrib
- btree_gin/expected
- btree_gist/expected
- src
- backend
- optimizer/path
- partitioning
- include/catalog
6 files changed
+40
-10
lines changedLines changed: 6 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
87 | 87 |
| |
88 | 88 |
| |
89 | 89 |
| |
90 |
| - | |
91 |
| - | |
| 90 | + | |
| 91 | + | |
92 | 92 |
| |
93 | 93 |
| |
94 |
| - | |
| 94 | + | |
95 | 95 |
| |
96 |
| - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
97 | 99 |
| |
98 | 100 |
| |
99 | 101 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
74 |
| - | |
| 74 | + | |
75 | 75 |
| |
76 | 76 |
| |
77 | 77 |
| |
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
88 |
| - | |
| 88 | + | |
89 | 89 |
| |
90 | 90 |
| |
91 | 91 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
| 156 | + | |
156 | 157 |
| |
157 | 158 |
| |
158 | 159 |
| |
| |||
2342 | 2343 |
| |
2343 | 2344 |
| |
2344 | 2345 |
| |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
2345 | 2363 |
| |
2346 | 2364 |
| |
2347 | 2365 |
| |
|
Lines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1191 | 1191 |
| |
1192 | 1192 |
| |
1193 | 1193 |
| |
1194 |
| - | |
1195 |
| - | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1196 | 1201 |
| |
1197 | 1202 |
| |
1198 | 1203 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3596 | 3596 |
| |
3597 | 3597 |
| |
3598 | 3598 |
| |
3599 |
| - | |
| 3599 | + | |
| 3600 | + | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
3600 | 3604 |
| |
3601 | 3605 |
| |
3602 | 3606 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
58 |
| - | |
| 58 | + | |
| 59 | + | |
59 | 60 |
| |
60 | 61 |
| |
61 | 62 |
| |
|
0 commit comments
Comments
(0)