• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

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

ログメッセージ

Took in an improvement of core code.

Core's planner gets improved as follows. Took it in.

9680c120e5 Change more places to be less trusting of RestrictInfo.is_pushed_down.

変更サマリ

差分

--- a/core.c
+++ b/core.c
@@ -20,7 +20,7 @@
2020 * mark_dummy_rel()
2121 * restriction_is_constant_false()
2222 *
23- * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
23+ * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
2424 * Portions Copyright (c) 1994, Regents of the University of California
2525 *
2626 *-------------------------------------------------------------------------
@@ -1243,18 +1243,21 @@ mark_dummy_rel(RelOptInfo *rel)
12431243 }
12441244
12451245 /*
1246- * restriction_is_constant_false --- is a restrictlist just FALSE?
1246+ * restriction_is_constant_false --- is a restrictlist just false?
12471247 *
1248- * In cases where a qual is provably constant FALSE, eval_const_expressions
1248+ * In cases where a qual is provably constant false, eval_const_expressions
12491249 * will generally have thrown away anything that's ANDed with it. In outer
12501250 * join situations this will leave us computing cartesian products only to
12511251 * decide there's no match for an outer row, which is pretty stupid. So,
12521252 * we need to detect the case.
12531253 *
1254- * If only_pushed_down is TRUE, then consider only pushed-down quals.
1254+ * If only_pushed_down is true, then consider only quals that are pushed-down
1255+ * from the point of view of the joinrel.
12551256 */
12561257 static bool
1257-restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
1258+restriction_is_constant_false(List *restrictlist,
1259+ RelOptInfo *joinrel,
1260+ bool only_pushed_down)
12581261 {
12591262 ListCell *lc;
12601263
@@ -1269,7 +1272,7 @@ restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
12691272 RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
12701273
12711274 Assert(IsA(rinfo, RestrictInfo));
1272- if (only_pushed_down && !rinfo->is_pushed_down)
1275+ if (only_pushed_down && !RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids))
12731276 continue;
12741277
12751278 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-2013, PostgreSQL Global Development Group
1111 * Portions Copyright (c) 1994, Regents of the University of California
1212 *
1313 *-------------------------------------------------------------------------
@@ -223,7 +223,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
223223 {
224224 case JOIN_INNER:
225225 if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
226- restriction_is_constant_false(restrictlist, false))
226+ restriction_is_constant_false(restrictlist, joinrel, false))
227227 {
228228 mark_dummy_rel(joinrel);
229229 break;
@@ -237,12 +237,12 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
237237 break;
238238 case JOIN_LEFT:
239239 if (is_dummy_rel(rel1) ||
240- restriction_is_constant_false(restrictlist, true))
240+ restriction_is_constant_false(restrictlist, joinrel, true))
241241 {
242242 mark_dummy_rel(joinrel);
243243 break;
244244 }
245- if (restriction_is_constant_false(restrictlist, false) &&
245+ if (restriction_is_constant_false(restrictlist, joinrel, false) &&
246246 bms_is_subset(rel2->relids, sjinfo->syn_righthand))
247247 mark_dummy_rel(rel2);
248248 add_paths_to_joinrel(root, joinrel, rel1, rel2,
@@ -254,7 +254,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
254254 break;
255255 case JOIN_FULL:
256256 if ((is_dummy_rel(rel1) && is_dummy_rel(rel2)) ||
257- restriction_is_constant_false(restrictlist, true))
257+ restriction_is_constant_false(restrictlist, joinrel, true))
258258 {
259259 mark_dummy_rel(joinrel);
260260 break;
@@ -290,7 +290,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
290290 bms_is_subset(sjinfo->min_righthand, rel2->relids))
291291 {
292292 if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
293- restriction_is_constant_false(restrictlist, false))
293+ restriction_is_constant_false(restrictlist, joinrel, false))
294294 {
295295 mark_dummy_rel(joinrel);
296296 break;
@@ -313,7 +313,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
313313 sjinfo) != NULL)
314314 {
315315 if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
316- restriction_is_constant_false(restrictlist, false))
316+ restriction_is_constant_false(restrictlist, joinrel, false))
317317 {
318318 mark_dummy_rel(joinrel);
319319 break;
@@ -328,12 +328,12 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
328328 break;
329329 case JOIN_ANTI:
330330 if (is_dummy_rel(rel1) ||
331- restriction_is_constant_false(restrictlist, true))
331+ restriction_is_constant_false(restrictlist, joinrel, true))
332332 {
333333 mark_dummy_rel(joinrel);
334334 break;
335335 }
336- if (restriction_is_constant_false(restrictlist, false) &&
336+ if (restriction_is_constant_false(restrictlist, joinrel, false) &&
337337 bms_is_subset(rel2->relids, sjinfo->syn_righthand))
338338 mark_dummy_rel(rel2);
339339 add_paths_to_joinrel(root, joinrel, rel1, rel2,
旧リポジトリブラウザで表示