forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9a3ddeb
committed
Fix index-only scan plans, take 2.
Commit4ace456 failed to fix the problem fully, because thesame issue of attempting to fetch a non-returnable index columncan occur when rechecking the indexqual after using a lossy indexoperator. Moreover, it broke EXPLAIN for such indexquals (whichindicates a gap in our test cases :-().Revert the code changes of4ace456 in favor of adding a new fieldto struct IndexOnlyScan, containing a version of the indexqual thatcan be executed against the index-returned tuple without using anynon-returnable columns. (The restrictions imposed by check_index_onlyguarantee this is possible, although we may have to recompute indexedexpressions.) Support construction of that during setrefs.cprocessing by marking IndexOnlyScan.indextlist entries as resjunkif they can't be returned, rather than removing them entirely.(We could alternatively require setrefs.c to look up the IndexOptInfoagain, but abusing resjunk this way seems like a reasonably safe wayto avoid needing to do that.)This solution isn't great from an API-stability standpoint: if thereare any extensions out there that build IndexOnlyScan structs directly,they'll be broken in the next minor releases. However, only a veryinvasive extension would be likely to do such a thing. There's nochange in the Path representation, so typical planner extensionsshouldn't have a problem.As before, back-patch to all supported branches.Discussion:https://postgr.es/m/3179992.1641150853@sss.pgh.pa.usDiscussion:https://postgr.es/m/17350-b5bdcf476e5badbb@postgresql.org1 parent4b16049 commit9a3ddeb
File tree
12 files changed
+124
-66
lines changed- src
- backend
- commands
- executor
- nodes
- optimizer/plan
- include/nodes
- test/regress
- expected
- sql
12 files changed
+124
-66
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1746 | 1746 |
| |
1747 | 1747 |
| |
1748 | 1748 |
| |
1749 |
| - | |
| 1749 | + | |
1750 | 1750 |
| |
1751 | 1751 |
| |
1752 | 1752 |
| |
|
Lines changed: 3 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
214 | 214 |
| |
215 | 215 |
| |
216 | 216 |
| |
217 |
| - | |
218 |
| - | |
219 | 217 |
| |
220 | 218 |
| |
221 | 219 |
| |
222 | 220 |
| |
223 |
| - | |
| 221 | + | |
224 | 222 |
| |
225 | 223 |
| |
226 | 224 |
| |
| |||
555 | 553 |
| |
556 | 554 |
| |
557 | 555 |
| |
558 |
| - | |
559 |
| - | |
| 556 | + | |
| 557 | + | |
560 | 558 |
| |
561 | 559 |
| |
562 | 560 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
519 | 519 |
| |
520 | 520 |
| |
521 | 521 |
| |
| 522 | + | |
522 | 523 |
| |
523 | 524 |
| |
524 | 525 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
580 | 580 |
| |
581 | 581 |
| |
582 | 582 |
| |
| 583 | + | |
583 | 584 |
| |
584 | 585 |
| |
585 | 586 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1884 | 1884 |
| |
1885 | 1885 |
| |
1886 | 1886 |
| |
| 1887 | + | |
1887 | 1888 |
| |
1888 | 1889 |
| |
1889 | 1890 |
| |
|
Lines changed: 27 additions & 53 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
24 | 23 |
| |
25 | 24 |
| |
26 | 25 |
| |
| |||
189 | 188 |
| |
190 | 189 |
| |
191 | 190 |
| |
192 |
| - | |
| 191 | + | |
| 192 | + | |
193 | 193 |
| |
194 | 194 |
| |
195 |
| - | |
196 | 195 |
| |
197 | 196 |
| |
198 | 197 |
| |
| |||
623 | 622 |
| |
624 | 623 |
| |
625 | 624 |
| |
626 |
| - | |
| 625 | + | |
627 | 626 |
| |
628 | 627 |
| |
629 | 628 |
| |
| |||
2934 | 2933 |
| |
2935 | 2934 |
| |
2936 | 2935 |
| |
2937 |
| - | |
| 2936 | + | |
| 2937 | + | |
2938 | 2938 |
| |
2939 | 2939 |
| |
2940 | 2940 |
| |
| |||
3064 | 3064 |
| |
3065 | 3065 |
| |
3066 | 3066 |
| |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
3067 | 3085 |
| |
3068 | 3086 |
| |
3069 | 3087 |
| |
3070 | 3088 |
| |
3071 | 3089 |
| |
3072 | 3090 |
| |
3073 | 3091 |
| |
| 3092 | + | |
3074 | 3093 |
| |
3075 |
| - | |
| 3094 | + | |
3076 | 3095 |
| |
3077 | 3096 |
| |
3078 | 3097 |
| |
| |||
5444 | 5463 |
| |
5445 | 5464 |
| |
5446 | 5465 |
| |
| 5466 | + | |
5447 | 5467 |
| |
5448 | 5468 |
| |
5449 | 5469 |
| |
| |||
5458 | 5478 |
| |
5459 | 5479 |
| |
5460 | 5480 |
| |
| 5481 | + | |
5461 | 5482 |
| |
5462 | 5483 |
| |
5463 | 5484 |
| |
5464 | 5485 |
| |
5465 | 5486 |
| |
5466 | 5487 |
| |
5467 | 5488 |
| |
5468 |
| - | |
5469 |
| - | |
5470 |
| - | |
5471 |
| - | |
5472 |
| - | |
5473 |
| - | |
5474 |
| - | |
5475 |
| - | |
5476 |
| - | |
5477 |
| - | |
5478 |
| - | |
5479 |
| - | |
5480 |
| - | |
5481 |
| - | |
5482 |
| - | |
5483 |
| - | |
5484 |
| - | |
5485 |
| - | |
5486 |
| - | |
5487 |
| - | |
5488 |
| - | |
5489 |
| - | |
5490 |
| - | |
5491 |
| - | |
5492 |
| - | |
5493 |
| - | |
5494 |
| - | |
5495 |
| - | |
5496 |
| - | |
5497 |
| - | |
5498 |
| - | |
5499 |
| - | |
5500 |
| - | |
5501 |
| - | |
5502 |
| - | |
5503 |
| - | |
5504 |
| - | |
5505 |
| - | |
5506 |
| - | |
5507 |
| - | |
5508 |
| - | |
5509 |
| - | |
5510 |
| - | |
5511 |
| - | |
5512 |
| - | |
5513 |
| - | |
5514 |
| - | |
5515 | 5489 |
| |
5516 | 5490 |
| |
5517 | 5491 |
| |
|
Lines changed: 26 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1142 | 1142 |
| |
1143 | 1143 |
| |
1144 | 1144 |
| |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
1145 | 1163 |
| |
1146 |
| - | |
| 1164 | + | |
1147 | 1165 |
| |
1148 | 1166 |
| |
1149 | 1167 |
| |
| |||
1160 | 1178 |
| |
1161 | 1179 |
| |
1162 | 1180 |
| |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1163 | 1188 |
| |
1164 | 1189 |
| |
1165 | 1190 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2336 | 2336 |
| |
2337 | 2337 |
| |
2338 | 2338 |
| |
| 2339 | + | |
| 2340 | + | |
2339 | 2341 |
| |
2340 | 2342 |
| |
2341 | 2343 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1490 | 1490 |
| |
1491 | 1491 |
| |
1492 | 1492 |
| |
1493 |
| - | |
| 1493 | + | |
1494 | 1494 |
| |
1495 | 1495 |
| |
1496 | 1496 |
| |
| |||
1509 | 1509 |
| |
1510 | 1510 |
| |
1511 | 1511 |
| |
1512 |
| - | |
| 1512 | + | |
1513 | 1513 |
| |
1514 | 1514 |
| |
1515 | 1515 |
| |
|
Lines changed: 18 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
420 | 420 |
| |
421 | 421 |
| |
422 | 422 |
| |
423 |
| - | |
424 |
| - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
425 | 437 |
| |
426 | 438 |
| |
427 | 439 |
| |
428 | 440 |
| |
429 | 441 |
| |
430 |
| - | |
431 |
| - | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
432 | 445 |
| |
433 | 446 |
| |
434 | 447 |
| |
435 | 448 |
| |
436 | 449 |
| |
437 | 450 |
| |
438 | 451 |
| |
| 452 | + | |
439 | 453 |
| |
440 | 454 |
| |
441 | 455 |
| |
|
Lines changed: 31 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
340 | 340 |
| |
341 | 341 |
| |
342 | 342 |
| |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
343 | 374 |
| |
344 | 375 |
| |
345 | 376 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
156 | 167 |
| |
157 | 168 |
| |
158 | 169 |
| |
|
0 commit comments
Comments
(0)