forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8352b14
committed
Make entirely-dummy appendrels get marked as such in set_append_rel_size.
The planner generally expects that the estimated rowcount of any relationis at least one row, *unless* it has been proven empty by constraintexclusion or similar mechanisms, which is marked by installing a dummy pathas the rel's cheapest path (cf. IS_DUMMY_REL). When I split upallpaths.c's processing of base rels into separate set_base_rel_sizes andset_base_rel_pathlists steps, the intention was that dummy rels would getmarked as such during the "set size" step; this is what justifies an Assertin indxpath.c's get_loop_count that other relations should either be dummyor have positive rowcount. Unfortunately I didn't get that quite rightfor append relations: if all the child rels have been proven empty thenset_append_rel_size would come up with a rowcount of zero, which iscorrect, but it didn't then do set_dummy_rel_pathlist. (We would haveended up with the right state after set_append_rel_pathlist, but that'stoo late, if we generate indexpaths for some other rel first.)In addition to fixing the actual bug, I installed an Assert enforcing thisconvention in set_rel_size; that then allows simplification of a coupleof now-redundant tests for zero rowcount in set_append_rel_size.Also, to cover the possibility that third-party FDWs have been carelessabout not returning a zero rowcount estimate, apply clamp_row_est towhatever an FDW comes up with as the rows estimate.Per report from Andreas Seltenreich. Back-patch to 9.2. Earlier branchesdid not have the separation between set_base_rel_sizes andset_base_rel_pathlists steps, so there was no intermediate state where anappendrel would have had inconsistent rowcount and pathlist. It's possiblethat adding the Assert to set_rel_size would be a good idea in olderbranches too; but since they're not under development any more, it's likelynot worth the trouble.1 parent84bf6ec commit8352b14
File tree
3 files changed
+93
-42
lines changed- src
- backend/optimizer/path
- test/regress
- expected
- sql
3 files changed
+93
-42
lines changedLines changed: 62 additions & 42 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
333 | 333 |
| |
334 | 334 |
| |
335 | 335 |
| |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
336 | 341 |
| |
337 | 342 |
| |
338 | 343 |
| |
| |||
462 | 467 |
| |
463 | 468 |
| |
464 | 469 |
| |
| 470 | + | |
| 471 | + | |
| 472 | + | |
465 | 473 |
| |
466 | 474 |
| |
467 | 475 |
| |
| |||
494 | 502 |
| |
495 | 503 |
| |
496 | 504 |
| |
| 505 | + | |
497 | 506 |
| |
498 | 507 |
| |
499 | 508 |
| |
| |||
514 | 523 |
| |
515 | 524 |
| |
516 | 525 |
| |
| 526 | + | |
517 | 527 |
| |
518 | 528 |
| |
519 | 529 |
| |
| |||
641 | 651 |
| |
642 | 652 |
| |
643 | 653 |
| |
| 654 | + | |
| 655 | + | |
| 656 | + | |
644 | 657 |
| |
645 | 658 |
| |
646 | 659 |
| |
647 |
| - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
648 | 675 |
| |
649 |
| - | |
650 |
| - | |
| 676 | + | |
| 677 | + | |
651 | 678 |
| |
652 |
| - | |
653 |
| - | |
654 |
| - | |
655 |
| - | |
656 |
| - | |
657 |
| - | |
658 |
| - | |
659 |
| - | |
660 |
| - | |
661 |
| - | |
| 679 | + | |
662 | 680 |
| |
663 |
| - | |
664 |
| - | |
| 681 | + | |
| 682 | + | |
665 | 683 |
| |
666 |
| - | |
| 684 | + | |
| 685 | + | |
667 | 686 |
| |
668 |
| - | |
669 |
| - | |
| 687 | + | |
670 | 688 |
| |
671 |
| - | |
672 |
| - | |
673 |
| - | |
674 |
| - | |
675 |
| - | |
676 |
| - | |
677 |
| - | |
678 |
| - | |
679 |
| - | |
680 |
| - | |
681 |
| - | |
682 |
| - | |
| 689 | + | |
683 | 690 |
| |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
684 | 696 |
| |
685 | 697 |
| |
686 | 698 |
| |
687 | 699 |
| |
688 |
| - | |
689 |
| - | |
690 |
| - | |
691 |
| - | |
692 |
| - | |
| 700 | + | |
693 | 701 |
| |
| 702 | + | |
| 703 | + | |
| 704 | + | |
694 | 705 |
| |
695 | 706 |
| |
| 707 | + | |
| 708 | + | |
696 | 709 |
| |
697 | 710 |
| |
698 | 711 |
| |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
699 | 718 |
| |
700 | 719 |
| |
701 |
| - | |
702 |
| - | |
703 |
| - | |
704 |
| - | |
705 |
| - | |
706 |
| - | |
707 |
| - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
708 | 728 |
| |
709 | 729 |
| |
710 | 730 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2164 | 2164 |
| |
2165 | 2165 |
| |
2166 | 2166 |
| |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
2167 | 2187 |
| |
2168 | 2188 |
| |
2169 | 2189 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
353 | 353 |
| |
354 | 354 |
| |
355 | 355 |
| |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
356 | 367 |
| |
357 | 368 |
| |
358 | 369 |
| |
|
0 commit comments
Comments
(0)