• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

リビジョンe608fb36b850ee5aca2af41703ed300ccf8ee841 (tree)
日時2018-06-08 14:11:30
作者Kyotaro Horiguchi <horiguchi.kyotaro@lab....>
コミッターKyotaro Horiguchi

ログメッセージ

Took in core improvement.

Took in the following commit of core.

58fec95268 Change more places to be less trusting of RestrictInfo.is_pushed_down.

変更サマリ

差分

--- a/core.c
+++ b/core.c
@@ -1244,18 +1244,21 @@ mark_dummy_rel(RelOptInfo *rel)
12441244 }
12451245
12461246 /*
1247- * restriction_is_constant_false --- is a restrictlist just FALSE?
1247+ * restriction_is_constant_false --- is a restrictlist just false?
12481248 *
1249- * In cases where a qual is provably constant FALSE, eval_const_expressions
1249+ * In cases where a qual is provably constant false, eval_const_expressions
12501250 * will generally have thrown away anything that's ANDed with it. In outer
12511251 * join situations this will leave us computing cartesian products only to
12521252 * decide there's no match for an outer row, which is pretty stupid. So,
12531253 * we need to detect the case.
12541254 *
1255- * If only_pushed_down is TRUE, then consider only pushed-down quals.
1255+ * If only_pushed_down is true, then consider only quals that are pushed-down
1256+ * from the point of view of the joinrel.
12561257 */
12571258 static bool
1258-restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
1259+restriction_is_constant_false(List *restrictlist,
1260+ RelOptInfo *joinrel,
1261+ bool only_pushed_down)
12591262 {
12601263 ListCell *lc;
12611264
@@ -1270,7 +1273,7 @@ restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
12701273 RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
12711274
12721275 Assert(IsA(rinfo, RestrictInfo));
1273- if (only_pushed_down && !rinfo->is_pushed_down)
1276+ if (only_pushed_down && !RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids))
12741277 continue;
12751278
12761279 if (rinfo->clause && IsA(rinfo->clause, Const))
--- a/make_join_rel.c
+++ b/make_join_rel.c
@@ -6,8 +6,8 @@
66 * src/backend/optimizer/path/joinrels.c
77 * make_join_rel()
88 *
9- * Portions Copyright (c) 2013-2014, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
10- * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
9+ * Portions Copyright (c) 2013-2018, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
10+ * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
1111 * Portions Copyright (c) 1994, Regents of the University of California
1212 *
1313 *-------------------------------------------------------------------------
@@ -226,7 +226,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
226226 {
227227 case JOIN_INNER:
228228 if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
229- restriction_is_constant_false(restrictlist, false))
229+ restriction_is_constant_false(restrictlist, joinrel, false))
230230 {
231231 mark_dummy_rel(joinrel);
232232 break;
@@ -240,12 +240,12 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
240240 break;
241241 case JOIN_LEFT:
242242 if (is_dummy_rel(rel1) ||
243- restriction_is_constant_false(restrictlist, true))
243+ restriction_is_constant_false(restrictlist, joinrel, true))
244244 {
245245 mark_dummy_rel(joinrel);
246246 break;
247247 }
248- if (restriction_is_constant_false(restrictlist, false) &&
248+ if (restriction_is_constant_false(restrictlist, joinrel, false) &&
249249 bms_is_subset(rel2->relids, sjinfo->syn_righthand))
250250 mark_dummy_rel(rel2);
251251 add_paths_to_joinrel(root, joinrel, rel1, rel2,
@@ -257,7 +257,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
257257 break;
258258 case JOIN_FULL:
259259 if ((is_dummy_rel(rel1) && is_dummy_rel(rel2)) ||
260- restriction_is_constant_false(restrictlist, true))
260+ restriction_is_constant_false(restrictlist, joinrel, true))
261261 {
262262 mark_dummy_rel(joinrel);
263263 break;
@@ -293,7 +293,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
293293 bms_is_subset(sjinfo->min_righthand, rel2->relids))
294294 {
295295 if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
296- restriction_is_constant_false(restrictlist, false))
296+ restriction_is_constant_false(restrictlist, joinrel, false))
297297 {
298298 mark_dummy_rel(joinrel);
299299 break;
@@ -316,7 +316,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
316316 sjinfo) != NULL)
317317 {
318318 if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
319- restriction_is_constant_false(restrictlist, false))
319+ restriction_is_constant_false(restrictlist, joinrel, false))
320320 {
321321 mark_dummy_rel(joinrel);
322322 break;
@@ -331,12 +331,12 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
331331 break;
332332 case JOIN_ANTI:
333333 if (is_dummy_rel(rel1) ||
334- restriction_is_constant_false(restrictlist, true))
334+ restriction_is_constant_false(restrictlist, joinrel, true))
335335 {
336336 mark_dummy_rel(joinrel);
337337 break;
338338 }
339- if (restriction_is_constant_false(restrictlist, false) &&
339+ if (restriction_is_constant_false(restrictlist, joinrel, false) &&
340340 bms_is_subset(rel2->relids, sjinfo->syn_righthand))
341341 mark_dummy_rel(rel2);
342342 add_paths_to_joinrel(root, joinrel, rel1, rel2,
旧リポジトリブラウザで表示