- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit491c24f
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 parent41ed5bb commit491c24f
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 | |
---|---|---|---|
| |||
343 | 343 |
| |
344 | 344 |
| |
345 | 345 |
| |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
346 | 351 |
| |
347 | 352 |
| |
348 | 353 |
| |
| |||
461 | 466 |
| |
462 | 467 |
| |
463 | 468 |
| |
| 469 | + | |
| 470 | + | |
| 471 | + | |
464 | 472 |
| |
465 | 473 |
| |
466 | 474 |
| |
| |||
493 | 501 |
| |
494 | 502 |
| |
495 | 503 |
| |
| 504 | + | |
496 | 505 |
| |
497 | 506 |
| |
498 | 507 |
| |
| |||
513 | 522 |
| |
514 | 523 |
| |
515 | 524 |
| |
| 525 | + | |
516 | 526 |
| |
517 | 527 |
| |
518 | 528 |
| |
| |||
640 | 650 |
| |
641 | 651 |
| |
642 | 652 |
| |
| 653 | + | |
| 654 | + | |
| 655 | + | |
643 | 656 |
| |
644 | 657 |
| |
645 | 658 |
| |
646 |
| - | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
647 | 674 |
| |
648 |
| - | |
649 |
| - | |
| 675 | + | |
| 676 | + | |
650 | 677 |
| |
651 |
| - | |
652 |
| - | |
653 |
| - | |
654 |
| - | |
655 |
| - | |
656 |
| - | |
657 |
| - | |
658 |
| - | |
659 |
| - | |
660 |
| - | |
| 678 | + | |
661 | 679 |
| |
662 |
| - | |
663 |
| - | |
| 680 | + | |
| 681 | + | |
664 | 682 |
| |
665 |
| - | |
| 683 | + | |
| 684 | + | |
666 | 685 |
| |
667 |
| - | |
668 |
| - | |
| 686 | + | |
669 | 687 |
| |
670 |
| - | |
671 |
| - | |
672 |
| - | |
673 |
| - | |
674 |
| - | |
675 |
| - | |
676 |
| - | |
677 |
| - | |
678 |
| - | |
679 |
| - | |
680 |
| - | |
681 |
| - | |
| 688 | + | |
682 | 689 |
| |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
683 | 695 |
| |
684 | 696 |
| |
685 | 697 |
| |
686 | 698 |
| |
687 |
| - | |
688 |
| - | |
689 |
| - | |
690 |
| - | |
691 |
| - | |
| 699 | + | |
692 | 700 |
| |
| 701 | + | |
| 702 | + | |
| 703 | + | |
693 | 704 |
| |
694 | 705 |
| |
| 706 | + | |
| 707 | + | |
695 | 708 |
| |
696 | 709 |
| |
697 | 710 |
| |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
698 | 717 |
| |
699 | 718 |
| |
700 |
| - | |
701 |
| - | |
702 |
| - | |
703 |
| - | |
704 |
| - | |
705 |
| - | |
706 |
| - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
707 | 727 |
| |
708 | 728 |
| |
709 | 729 |
| |
|
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)