Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8d96f57

Browse files
committed
Improve planner's handling of SetOp plans.
Remove the code for inserting flag columns in the inputs of a SetOp.That was the only reason why there would be resjunk columns in aset-operations plan tree, so we can get rid of some code thatsupported that, too.Get rid of choose_hashed_setop() in favor of building Paths forthe hashed and sorted alternatives, and letting them fight it outwithin add_path().Remove set_operation_ordered_results_useful(), which was giving wronganswers due to examining the wrong ancestor node: we need to examinethe immediate SetOperationStmt parent not the topmost node. Insteadmake each caller of recurse_set_operations() pass down the relevantparent node. (This thinko seems to have led only to wasted planningcycles and possibly-inferior plans, not wrong query answers. Perhapswe should back-patch it, but I'm not doing so right now.)Teach generate_nonunion_paths() to consider pre-sorted inputs forsorted SetOps, rather than always generating a Sort node.Patch by me; thanks to Richard Guo and David Rowley for review.Discussion:https://postgr.es/m/1850138.1731549611@sss.pgh.pa.us
1 parent2762792 commit8d96f57

File tree

8 files changed

+365
-332
lines changed

8 files changed

+365
-332
lines changed

‎src/backend/optimizer/plan/planner.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
616616
* setops is used for set operation subqueries to provide the subquery with
617617
* the context in which it's being used so that Paths correctly sorted for the
618618
* set operation can be generated. NULL when not planning a set operation
619-
* child.
619+
* child, or when a child of a set op that isn't interested in sorted input.
620620
*
621621
* Basically, this routine does the stuff that should only be done once
622622
* per Query object. It then calls grouping_planner. At one time,
@@ -1350,7 +1350,7 @@ preprocess_phv_expression(PlannerInfo *root, Expr *expr)
13501350
* setops is used for set operation subqueries to provide the subquery with
13511351
* the context in which it's being used so that Paths correctly sorted for the
13521352
* set operation can be generated. NULL when not planning a set operation
1353-
* child.
1353+
* child, or when a child of a set op that isn't interested in sorted input.
13541354
*
13551355
* Returns nothing; the useful output is in the Paths we attach to the
13561356
* (UPPERREL_FINAL, NULL) upperrel in *root. In addition,
@@ -3467,8 +3467,7 @@ standard_qp_callback(PlannerInfo *root, void *extra)
34673467
tlist);
34683468

34693469
/* setting setop_pathkeys might be useful to the union planner */
3470-
if (qp_extra->setop!=NULL&&
3471-
set_operation_ordered_results_useful(qp_extra->setop))
3470+
if (qp_extra->setop!=NULL)
34723471
{
34733472
List*groupClauses;
34743473
boolsortable;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp