* try_mergejoin_path * Consider a merge join path; if it appears useful, push it into * the joinrel's pathlist via add_path(). */
| 926 | * the joinrel's pathlist via add_path(). |
| 927 | */ |
| 928 | static void |
| 929 | try_mergejoin_path(PlannerInfo *root, |
| 930 | RelOptInfo *joinrel, |
| 931 | Path *outer_path, |
| 932 | Path *inner_path, |
| 933 | List *pathkeys, |
| 934 | List *mergeclauses, |
| 935 | List *outersortkeys, |
| 936 | List *innersortkeys, |
| 937 | JoinType jointype, |
| 938 | JoinType orig_jointype, |
| 939 | JoinPathExtraData *extra, |
| 940 | bool is_partial) |
| 941 | { |
| 942 | Relids required_outer; |
| 943 | JoinCostWorkspace workspace; |
| 944 | |
| 945 | if (is_partial) |
| 946 | { |
| 947 | try_partial_mergejoin_path(root, |
| 948 | joinrel, |
| 949 | outer_path, |
| 950 | inner_path, |
| 951 | pathkeys, |
| 952 | mergeclauses, |
| 953 | outersortkeys, |
| 954 | innersortkeys, |
| 955 | jointype, |
| 956 | orig_jointype, |
| 957 | extra); |
| 958 | return; |
| 959 | } |
| 960 | |
| 961 | /* |
| 962 | * Check to see if proposed path is still parameterized, and reject if the |
| 963 | * parameterization wouldn't be sensible. |
| 964 | */ |
| 965 | required_outer = calc_non_nestloop_required_outer(outer_path, |
| 966 | inner_path); |
| 967 | if (required_outer && |
| 968 | !bms_overlap(required_outer, extra->param_source_rels)) |
| 969 | { |
| 970 | /* Waste no memory when we reject a path here */ |
| 971 | bms_free(required_outer); |
| 972 | return; |
| 973 | } |
| 974 | |
| 975 | /* |
| 976 | * If the given paths are already well enough ordered, we can skip doing |
| 977 | * an explicit sort. |
| 978 | */ |
| 979 | if (outersortkeys && |
| 980 | pathkeys_contained_in(outersortkeys, outer_path->pathkeys)) |
| 981 | outersortkeys = NIL; |
| 982 | if (innersortkeys && |
| 983 | pathkeys_contained_in(innersortkeys, inner_path->pathkeys)) |
| 984 | innersortkeys = NIL; |
| 985 |
no test coverage detected