* try_nestloop_path * Consider a nestloop join path; if it appears useful, push it into * the joinrel's pathlist via add_path(). */
| 717 | * the joinrel's pathlist via add_path(). |
| 718 | */ |
| 719 | static void |
| 720 | try_nestloop_path(PlannerInfo *root, |
| 721 | RelOptInfo *joinrel, |
| 722 | Path *outer_path, |
| 723 | Path *inner_path, |
| 724 | List *pathkeys, |
| 725 | JoinType jointype, |
| 726 | JoinType orig_jointype, /* CDB */ |
| 727 | JoinPathExtraData *extra) |
| 728 | { |
| 729 | Relids required_outer; |
| 730 | JoinCostWorkspace workspace; |
| 731 | RelOptInfo *innerrel = inner_path->parent; |
| 732 | RelOptInfo *outerrel = outer_path->parent; |
| 733 | Relids innerrelids; |
| 734 | Relids outerrelids; |
| 735 | Relids inner_paramrels = PATH_REQ_OUTER(inner_path); |
| 736 | Relids outer_paramrels = PATH_REQ_OUTER(outer_path); |
| 737 | |
| 738 | /* |
| 739 | * Paths are parameterized by top-level parents, so run parameterization |
| 740 | * tests on the parent relids. |
| 741 | */ |
| 742 | if (innerrel->top_parent_relids) |
| 743 | innerrelids = innerrel->top_parent_relids; |
| 744 | else |
| 745 | innerrelids = innerrel->relids; |
| 746 | |
| 747 | if (outerrel->top_parent_relids) |
| 748 | outerrelids = outerrel->top_parent_relids; |
| 749 | else |
| 750 | outerrelids = outerrel->relids; |
| 751 | |
| 752 | /* |
| 753 | * Check to see if proposed path is still parameterized, and reject if the |
| 754 | * parameterization wouldn't be sensible --- unless allow_star_schema_join |
| 755 | * says to allow it anyway. Also, we must reject if have_dangerous_phv |
| 756 | * doesn't like the look of it, which could only happen if the nestloop is |
| 757 | * still parameterized. |
| 758 | */ |
| 759 | required_outer = calc_nestloop_required_outer(outerrelids, outer_paramrels, |
| 760 | innerrelids, inner_paramrels); |
| 761 | if (required_outer && |
| 762 | ((!bms_overlap(required_outer, extra->param_source_rels) && |
| 763 | !allow_star_schema_join(root, outerrelids, inner_paramrels)) || |
| 764 | have_dangerous_phv(root, outerrelids, inner_paramrels))) |
| 765 | { |
| 766 | /* Waste no memory when we reject a path here */ |
| 767 | bms_free(required_outer); |
| 768 | return; |
| 769 | } |
| 770 | |
| 771 | /* |
| 772 | * Do a precheck to quickly eliminate obviously-inferior paths. We |
| 773 | * calculate a cheap lower bound on the path's cost and then use |
| 774 | * add_path_precheck() to see if the path is clearly going to be dominated |
| 775 | * by some existing path for the joinrel. If not, do the full pushup with |
| 776 | * creating a fully valid path structure and submitting it to add_path(). |
no test coverage detected