firtst release
修訂 | 066f0649c604b6a672bca3c3e51311769c5b3d81 (tree) |
---|---|
時間 | 2018-06-08 14:12:56 |
作者 | Kyotaro Horiguchi <horiguchi.kyotaro@lab....> |
Commiter | Kyotaro Horiguchi |
Took in core improvement.
Took in the following commit of core.
80e12a6218 Change more places to be less trusting of RestrictInfo.is_pushed_down.
Fixed typos and removed useless include on the way.
@@ -20,7 +20,7 @@ | ||
20 | 20 | * mark_dummy_rel() |
21 | 21 | * restriction_is_constant_false() |
22 | 22 | * |
23 | - * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group | |
23 | + * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group | |
24 | 24 | * Portions Copyright (c) 1994, Regents of the University of California |
25 | 25 | * |
26 | 26 | *------------------------------------------------------------------------- |
@@ -1224,18 +1224,21 @@ mark_dummy_rel(RelOptInfo *rel) | ||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | /* |
1227 | - * restriction_is_constant_false --- is a restrictlist just FALSE? | |
1227 | + * restriction_is_constant_false --- is a restrictlist just false? | |
1228 | 1228 | * |
1229 | - * In cases where a qual is provably constant FALSE, eval_const_expressions | |
1229 | + * In cases where a qual is provably constant false, eval_const_expressions | |
1230 | 1230 | * will generally have thrown away anything that's ANDed with it. In outer |
1231 | 1231 | * join situations this will leave us computing cartesian products only to |
1232 | 1232 | * decide there's no match for an outer row, which is pretty stupid. So, |
1233 | 1233 | * we need to detect the case. |
1234 | 1234 | * |
1235 | - * If only_pushed_down is TRUE, then consider only pushed-down quals. | |
1235 | + * If only_pushed_down is true, then consider only quals that are pushed-down | |
1236 | + * from the point of view of the joinrel. | |
1236 | 1237 | */ |
1237 | 1238 | static bool |
1238 | -restriction_is_constant_false(List *restrictlist, bool only_pushed_down) | |
1239 | +restriction_is_constant_false(List *restrictlist, | |
1240 | + RelOptInfo *joinrel, | |
1241 | + bool only_pushed_down) | |
1239 | 1242 | { |
1240 | 1243 | ListCell *lc; |
1241 | 1244 |
@@ -1250,7 +1253,7 @@ restriction_is_constant_false(List *restrictlist, bool only_pushed_down) | ||
1250 | 1253 | RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc); |
1251 | 1254 | |
1252 | 1255 | Assert(IsA(rinfo, RestrictInfo)); |
1253 | - if (only_pushed_down && !rinfo->is_pushed_down) | |
1256 | + if (only_pushed_down && !RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids)) | |
1254 | 1257 | continue; |
1255 | 1258 | |
1256 | 1259 | if (rinfo->clause && IsA(rinfo->clause, Const)) |
@@ -6,8 +6,8 @@ | ||
6 | 6 | * src/backend/optimizer/path/joinrels.c |
7 | 7 | * make_join_rel() |
8 | 8 | * |
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-2015, PostgreSQL Global Development Group | |
11 | 11 | * Portions Copyright (c) 1994, Regents of the University of California |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
@@ -229,7 +229,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) | ||
229 | 229 | { |
230 | 230 | case JOIN_INNER: |
231 | 231 | if (is_dummy_rel(rel1) || is_dummy_rel(rel2) || |
232 | - restriction_is_constant_false(restrictlist, false)) | |
232 | + restriction_is_constant_false(restrictlist, joinrel, false)) | |
233 | 233 | { |
234 | 234 | mark_dummy_rel(joinrel); |
235 | 235 | break; |
@@ -243,12 +243,12 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) | ||
243 | 243 | break; |
244 | 244 | case JOIN_LEFT: |
245 | 245 | if (is_dummy_rel(rel1) || |
246 | - restriction_is_constant_false(restrictlist, true)) | |
246 | + restriction_is_constant_false(restrictlist, joinrel, true)) | |
247 | 247 | { |
248 | 248 | mark_dummy_rel(joinrel); |
249 | 249 | break; |
250 | 250 | } |
251 | - if (restriction_is_constant_false(restrictlist, false) && | |
251 | + if (restriction_is_constant_false(restrictlist, joinrel, false) && | |
252 | 252 | bms_is_subset(rel2->relids, sjinfo->syn_righthand)) |
253 | 253 | mark_dummy_rel(rel2); |
254 | 254 | add_paths_to_joinrel(root, joinrel, rel1, rel2, |
@@ -260,7 +260,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) | ||
260 | 260 | break; |
261 | 261 | case JOIN_FULL: |
262 | 262 | if ((is_dummy_rel(rel1) && is_dummy_rel(rel2)) || |
263 | - restriction_is_constant_false(restrictlist, true)) | |
263 | + restriction_is_constant_false(restrictlist, joinrel, true)) | |
264 | 264 | { |
265 | 265 | mark_dummy_rel(joinrel); |
266 | 266 | break; |
@@ -296,7 +296,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) | ||
296 | 296 | bms_is_subset(sjinfo->min_righthand, rel2->relids)) |
297 | 297 | { |
298 | 298 | if (is_dummy_rel(rel1) || is_dummy_rel(rel2) || |
299 | - restriction_is_constant_false(restrictlist, false)) | |
299 | + restriction_is_constant_false(restrictlist, joinrel, false)) | |
300 | 300 | { |
301 | 301 | mark_dummy_rel(joinrel); |
302 | 302 | break; |
@@ -319,7 +319,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) | ||
319 | 319 | sjinfo) != NULL) |
320 | 320 | { |
321 | 321 | if (is_dummy_rel(rel1) || is_dummy_rel(rel2) || |
322 | - restriction_is_constant_false(restrictlist, false)) | |
322 | + restriction_is_constant_false(restrictlist, joinrel, false)) | |
323 | 323 | { |
324 | 324 | mark_dummy_rel(joinrel); |
325 | 325 | break; |
@@ -334,12 +334,12 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) | ||
334 | 334 | break; |
335 | 335 | case JOIN_ANTI: |
336 | 336 | if (is_dummy_rel(rel1) || |
337 | - restriction_is_constant_false(restrictlist, true)) | |
337 | + restriction_is_constant_false(restrictlist, joinrel, true)) | |
338 | 338 | { |
339 | 339 | mark_dummy_rel(joinrel); |
340 | 340 | break; |
341 | 341 | } |
342 | - if (restriction_is_constant_false(restrictlist, false) && | |
342 | + if (restriction_is_constant_false(restrictlist, joinrel, false) && | |
343 | 343 | bms_is_subset(rel2->relids, sjinfo->syn_righthand)) |
344 | 344 | mark_dummy_rel(rel2); |
345 | 345 | add_paths_to_joinrel(root, joinrel, rel1, rel2, |
@@ -10,8 +10,6 @@ | ||
10 | 10 | */ |
11 | 11 | #include "postgres.h" |
12 | 12 | |
13 | -#include <sys/stat.h> | |
14 | - | |
15 | 13 | #include "access/hash.h" |
16 | 14 | #include "parser/scanner.h" |
17 | 15 |