OSDN Git Service
(root)
/
pghintplan
/
pg_hint_plan.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support PostgreSQL 14
[pghintplan/pg_hint_plan.git]
/
make_join_rel.c
diff --git
a/make_join_rel.c
b/make_join_rel.c
index
d57b6da
..
638e500
100644
(file)
--- a/
make_join_rel.c
+++ b/
make_join_rel.c
@@
-5,19
+5,20
@@
* modifications.
*
* src/backend/optimizer/path/joinrels.c
* modifications.
*
* src/backend/optimizer/path/joinrels.c
+ *
+ * This file contains the following functions from corresponding files.
+ *
+ * static functions:
* make_join_rel()
* make_join_rel()
+ * populate_joinrel_with_paths()
*
*
- * Portions Copyright (c) 2013-20
17
, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
- * Portions Copyright (c) 1996-20
17
, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2013-20
20
, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+ * Portions Copyright (c) 1996-20
20
, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*-------------------------------------------------------------------------
*/
* Portions Copyright (c) 1994, Regents of the University of California
*
*-------------------------------------------------------------------------
*/
-static void populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
- RelOptInfo *rel2, RelOptInfo *joinrel,
- SpecialJoinInfo *sjinfo,
- List *restrictlist);
/*
* adjust_rows: tweak estimated row numbers according to the hint.
*/
/*
* adjust_rows: tweak estimated row numbers according to the hint.
*/
@@
-48,6
+49,7
@@
adjust_rows(double rows, RowsHint *hint)
return result;
}
return result;
}
+
/*
* make_join_rel
* Find or create a join RelOptInfo that represents the join of
/*
* make_join_rel
* Find or create a join RelOptInfo that represents the join of
@@
-124,7
+126,7
@@
make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
joinrel = build_join_rel(root, joinrelids, rel1, rel2, sjinfo,
&restrictlist);
joinrel = build_join_rel(root, joinrelids, rel1, rel2, sjinfo,
&restrictlist);
- /* !!! START: HERE IS THE PART WHICH ADDED FOR PG_HINT_PLAN !!! */
+ /* !!! START: HERE IS THE PART WHICH
IS
ADDED FOR PG_HINT_PLAN !!! */
{
RowsHint *rows_hint = NULL;
int i;
{
RowsHint *rows_hint = NULL;
int i;
@@
-200,7
+202,7
@@
make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
}
}
}
}
- /* !!! END: HERE IS THE PART WHICH ADDED FOR PG_HINT_PLAN !!! */
+ /* !!! END: HERE IS THE PART WHICH
IS
ADDED FOR PG_HINT_PLAN !!! */
/*
* If we've already proven this join is empty, we needn't consider any
/*
* If we've already proven this join is empty, we needn't consider any
@@
-221,6
+223,7
@@
make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
return joinrel;
}
return joinrel;
}
+
/*
* populate_joinrel_with_paths
* Add paths to the given joinrel for given pair of joining relations. The
/*
* populate_joinrel_with_paths
* Add paths to the given joinrel for given pair of joining relations. The
@@
-255,7
+258,7
@@
populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
{
case JOIN_INNER:
if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
{
case JOIN_INNER:
if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
- restriction_is_constant_false(restrictlist, false))
+ restriction_is_constant_false(restrictlist,
joinrel,
false))
{
mark_dummy_rel(joinrel);
break;
{
mark_dummy_rel(joinrel);
break;
@@
-269,12
+272,12
@@
populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
break;
case JOIN_LEFT:
if (is_dummy_rel(rel1) ||
break;
case JOIN_LEFT:
if (is_dummy_rel(rel1) ||
- restriction_is_constant_false(restrictlist, true))
+ restriction_is_constant_false(restrictlist,
joinrel,
true))
{
mark_dummy_rel(joinrel);
break;
}
{
mark_dummy_rel(joinrel);
break;
}
- if (restriction_is_constant_false(restrictlist, false) &&
+ if (restriction_is_constant_false(restrictlist,
joinrel,
false) &&
bms_is_subset(rel2->relids, sjinfo->syn_righthand))
mark_dummy_rel(rel2);
add_paths_to_joinrel(root, joinrel, rel1, rel2,
bms_is_subset(rel2->relids, sjinfo->syn_righthand))
mark_dummy_rel(rel2);
add_paths_to_joinrel(root, joinrel, rel1, rel2,
@@
-286,7
+289,7
@@
populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
break;
case JOIN_FULL:
if ((is_dummy_rel(rel1) && is_dummy_rel(rel2)) ||
break;
case JOIN_FULL:
if ((is_dummy_rel(rel1) && is_dummy_rel(rel2)) ||
- restriction_is_constant_false(restrictlist, true))
+ restriction_is_constant_false(restrictlist,
joinrel,
true))
{
mark_dummy_rel(joinrel);
break;
{
mark_dummy_rel(joinrel);
break;
@@
-322,7
+325,7
@@
populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
bms_is_subset(sjinfo->min_righthand, rel2->relids))
{
if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
bms_is_subset(sjinfo->min_righthand, rel2->relids))
{
if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
- restriction_is_constant_false(restrictlist, false))
+ restriction_is_constant_false(restrictlist,
joinrel,
false))
{
mark_dummy_rel(joinrel);
break;
{
mark_dummy_rel(joinrel);
break;
@@
-345,7
+348,7
@@
populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
sjinfo) != NULL)
{
if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
sjinfo) != NULL)
{
if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
- restriction_is_constant_false(restrictlist, false))
+ restriction_is_constant_false(restrictlist,
joinrel,
false))
{
mark_dummy_rel(joinrel);
break;
{
mark_dummy_rel(joinrel);
break;
@@
-360,12
+363,12
@@
populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
break;
case JOIN_ANTI:
if (is_dummy_rel(rel1) ||
break;
case JOIN_ANTI:
if (is_dummy_rel(rel1) ||
- restriction_is_constant_false(restrictlist, true))
+ restriction_is_constant_false(restrictlist,
joinrel,
true))
{
mark_dummy_rel(joinrel);
break;
}
{
mark_dummy_rel(joinrel);
break;
}
- if (restriction_is_constant_false(restrictlist, false) &&
+ if (restriction_is_constant_false(restrictlist,
joinrel,
false) &&
bms_is_subset(rel2->relids, sjinfo->syn_righthand))
mark_dummy_rel(rel2);
add_paths_to_joinrel(root, joinrel, rel1, rel2,
bms_is_subset(rel2->relids, sjinfo->syn_righthand))
mark_dummy_rel(rel2);
add_paths_to_joinrel(root, joinrel, rel1, rel2,
@@
-377,4
+380,7
@@
populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
elog(ERROR, "unrecognized join type: %d", (int) sjinfo->jointype);
break;
}
elog(ERROR, "unrecognized join type: %d", (int) sjinfo->jointype);
break;
}
+
+ /* Apply partitionwise join technique, if possible. */
+ try_partitionwise_join(root, rel1, rel2, joinrel, sjinfo, restrictlist);
}
}