8000 Push target list evaluation through Gather Merge. · postgres/postgres@44ae64c · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"commit":{"oid":"44ae64c388bde6e4b077272570c84dedfb17bed3","url":"/postgres/postgres/commit/44ae64c388bde6e4b077272570c84dedfb17bed3","authoredDate":"2017-11-13T16:33:56.000-05:00","committedDate":"2017-11-13T16:37:42.000-05:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003ePush target list evaluation through Gather Merge.\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"We already do this for Gather, but it got overlooked for Gather Merge.\n\nAmit Kapila, with review and minor revisions by Rushabh Lathia\nand by me.\n\nDiscussion: \u003ca href=\"http://postgr.es/m/CAA4eK1KUC5Uyu7qaifxrjpHxbSeoQh3yzwN3bThnJsmJcZ-qtA@mail.gmail.com\" rel=\"nofollow\"\u003ehttp://postgr.es/m/CAA4eK1KUC5Uyu7qaifxrjpHxbSeoQh3yzwN3bThnJsmJcZ-qtA@mail.gmail.com\u003c/a\u003e","authors":[{"login":"robertmhaas","displayName":"Robert Haas","avatarUrl":"https://avatars.githubusercontent.com/u/886678?v=4","path":"/robertmhaas","isGitHub":false}],"committerAttribution":false,"committer":{"login":"robertmhaas","displayName":"Robert Haas","avatarUrl":"https://avatars.githubusercontent.com/u/886678?v=4","path":"/robertmhaas","isGitHub":false},"parents":["e64861c79bda659ee384bc253f651401f953dadc"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOjQ0YWU2NGMzODhiZGU2ZTRiMDc3MjcyNTcwYzg0ZGVkZmIxN2JlZDM=","sha1":"e64861c79bda659ee384bc253f651401f953dadc","sha2":"44ae64c388bde6e4b077272570c84dedfb17bed3"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":5059,"text":"@@ -5060,7 +5060,8 @@ create_ordered_paths(PlannerInfo *root,","html":"@@ -5060,7 +5060,8 @@ create_ordered_paths(PlannerInfo *root,","displayNoNewLineWarning":false,"position":0,"left":5059,"right":5059},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":5060,"text":" \t\t\tpath = (Path *)","html":" \t\t\t\u003cspan class=pl-s1\u003epath\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003ePath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e)","displayNoNewLineWarning":false,"position":1,"left":5060,"right":5060},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":5061,"text":" \t\t\t\tcreate_gather_merge_path(root, ordered_rel,","html":" \t\t\t\t\u003cspan class=pl-en\u003ecreate_gather_merge_path\u003c/span\u003e(\u003cspan class=pl-s1\u003eroot\u003c/span\u003e, \u003cspan class=pl-s1\u003eordered_rel\u003c/span\u003e,","displayNoNewLineWarning":false,"position":2,"left":5061,"right":5061},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":5062,"text":" \t\t\t\t\t\t\t\t\t\t path,","html":" \t\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003epath\u003c/span\u003e,","displayNoNewLineWarning":false,"position":3,"left":5062,"right":5062},{"stylingDirective":null,"type":"DELETION","blobLineNumber":5063,"text":"-\t\t\t\t\t\t\t\t\t\t target, root-\u003esort_pathkeys, NULL,","html":"-\t\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003etarget\u003c/span\u003e, \u003cspan class=pl-s1\u003eroot\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esort_pathkeys\u003c/span\u003e, \u003cspan class=pl-c1\u003eNULL\u003c/span\u003e,","displayNoNewLineWarning":false,"position":4,"left":5063,"right":5062},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":5063,"text":"+\t\t\t\t\t\t\t\t\t\t path-\u003epathtarget,","html":"+\t\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003epath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003epathtarget\u003c/span\u003e,","displayNoNewLineWarning":false,"position":5,"left":5063,"right":5063},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":5064,"text":"+\t\t\t\t\t\t\t\t\t\t root-\u003esort_pathkeys, NULL,","html":"+\t\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003eroot\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esort_pathkeys\u003c/span\u003e, \u003cspan class=pl-c1\u003eNULL\u003c/span\u003e,","displayNoNewLineWarning":false,"position":6,"left":5063,"right":5064},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":5065,"text":" \t\t\t\t\t\t\t\t\t\t \u0026total_groups);","html":" \t\t\t\t\t\t\t\t\t\t \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e\u003cspan class=pl-s1\u003etotal_groups\u003c/span\u003e);","displayNoNewLineWarning":false,"position":7,"left":5064,"right":5065},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":5066,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":8,"left":5065,"right":5066},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":5067,"text":" \t\t\t/* Add projection step if needed */","html":" \t\t\t\u003cspan class=pl-c\u003e/* Add projection step if needed */\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":5066,"right":5067}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":6197,"linesChanged":3,"newTreeEntry":{"lineCount":6197,"path":"src/backend/optimizer/plan/planner.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/optimizer/plan/planner.c","mode":100644},"linesAdded":2,"linesDeleted":1,"path":"src/backend/optimizer/plan/planner.c","pathDigest":"c6e13617216e8b159a017b78dea5eae9966e17e98e0ba6e818a352ecac5bbcf7","status":"MODIFIED","truncatedReason":null,"oldOid":"e64861c79bda659ee384bc253f651401f953dadc","newOid":"44ae64c388bde6e4b077272570c84dedfb17bed3","copilotChatReference":null,"deletedSha":"e64861c79bda659ee384bc253f651401f953dadc","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":2367,"text":"@@ -2368,9 +2368,9 @@ create_projection_path(PlannerInfo *root,","html":"@@ -2368,9 +2368,9 @@ create_projection_path(PlannerInfo *root,","displayNoNewLineWarning":false,"position":0,"left":2367,"right":2367},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2368,"text":" * knows that the given path isn't referenced elsewhere and so can be modified","html":" \u003cspan class=pl-c\u003e * knows that the given path isn\u0026#39;t referenced elsewhere and so can be modified\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":2368,"right":2368},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2369,"text":" * in-place.","html":" \u003cspan class=pl-c\u003e * in-place.\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":2369,"right":2369},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2370,"text":" *","html":" \u003cspan class=pl-c\u003e *\u003c/span\u003e","displayNoNewLineWarning":false,"position":3,"left":2370,"right":2370},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2371,"text":"- * If the input path is a GatherPath, we try to push the new target down to","html":"-\u003cspan class=\"pl-c\"\u003e * If the input path is a GatherPath, we try to push the\u003cspan class=\"x x-first x-last\"\u003e new target down to\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":2371,"right":2370},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2372,"text":"- * its input as well; this is a yet more invasive modification of the input","html":"-\u003cspan class=\"pl-c\"\u003e * its input as well; this is a yet more invasive\u003cspan class=\"x x-first x-last\"\u003e modification of the input\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":2372,"right":2370},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2373,"text":"- * path, which create_projection_path() can't do.","html":"-\u003cspan class=\"pl-c\"\u003e * path, which create_projection_path() can't do.\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":2373,"right":2370},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2371,"text":"+ * If the input path is a GatherPath or GatherMergePath, we try to push the","html":"+\u003cspan class=\"pl-c\"\u003e * If the input path is a GatherPath\u003cspan class=\"x x-first x-last\"\u003e or GatherMergePath\u003c/span\u003e, we try to push the\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":2373,"right":2371},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2372,"text":"+ * new target down to its input as well; this is a yet more invasive","html":"+\u003cspan class=\"pl-c\"\u003e * \u003cspan class=\"x x-first x-last\"\u003enew target down to \u003c/span\u003eits input as well; this is a yet more invasive\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":2373,"right":2372},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2373,"text":"+ * modification of the input path, which create_projection_path() can't do.","html":"+\u003cspan class=\"pl-c\"\u003e * \u003cspan class=\"x x-first x-last\"\u003emodification of the input \u003c/span\u003epath, which create_projection_path() can't do.\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":2373,"right":2373},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2374,"text":" *","html":" \u003cspan class=pl-c\u003e *\u003c/span\u003e","displayNoNewLineWarning":false,"position":10,"left":2374,"right":2374},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2375,"text":" * Note that we mustn't change the source path's parent link; so when it is","html":" \u003cspan class=pl-c\u003e * Note that we mustn\u0026#39;t change the source path\u0026#39;s parent link; so when it is\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":2375,"right":2375},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2376,"text":" * add_path'd to \"rel\" things will be a bit inconsistent. So far that has","html":" \u003cspan class=pl-c\u003e * add_path\u0026#39;d to \u0026quot;rel\u0026quot; things will be a bit inconsistent. So far that has\u003c/span\u003e","displayNoNewLineWarning":false,"position":12,"left":2376,"right":2376},{"stylingDirective":null,"type":"HUNK","blobLineNumber":2406,"text":"@@ -2407,31 +2407,44 @@ apply_projection_to_path(PlannerInfo *root,","html":"@@ -2407,31 +2407,44 @@ apply_projection_to_path(PlannerInfo *root,","displayNoNewLineWarning":false,"position":13,"left":2406,"right":2406},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2407,"text":" \t\t(target-\u003ecost.per_tuple - oldcost.per_tuple) * path-\u003erows;","html":" \t\t(\u003cspan class=pl-s1\u003etarget\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ecost\u003c/span\u003e.\u003cspan class=pl-c1\u003eper_tuple\u003c/span\u003e \u003cspan class=pl-c1\u003e-\u003c/span\u003e \u003cspan class=pl-s1\u003eoldcost\u003c/span\u003e.\u003cspan class=pl-c1\u003eper_tuple\u003c/span\u003e) \u003cspan class=pl-c1\u003e*\u003c/span\u003e \u003cspan class=pl-s1\u003epath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erows\u003c/span\u003e;","displayNoNewLineWarning":false,"position":14,"left":2407,"right":2407},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2408,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":15,"left":2408,"right":2408},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2409,"text":" \t/*","html":" \t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":16,"left":2409,"right":2409},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2410,"text":"-\t * If the path happens to be a Gather path, we'd like to arrange for the","html":"-\u003cspan class=\"pl-c\"\u003e\t * If the path happens to be a Gather path, we'd like to\u003cspan class=\"x x-first x-last\"\u003e arrange for the\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":2410,"right":2409},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2411,"text":"-\t * subpath to return the required target list so that workers can help","html":"-\u003cspan class=\"pl-c\"\u003e\t * subpath to return the required target list so that\u003cspan class=\"x x-first x-last\"\u003e workers can help\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":2411,"right":2409},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2412,"text":"-\t * project. But if there is something that is not parallel-safe in the","html":"-\u003cspan class=\"pl-c\"\u003e\t * project. But if there is something that is not\u003cspan class=\"x x-first x-last\"\u003e parallel-safe in the\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":19,"left":2412,"right":2409},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2413,"text":"-\t * target expressions, then we can't.","html":"-\u003cspan class=\"pl-c\"\u003e\t * target expressions, then we can't.\u003c/span\u003e","displayNoNewLineWarning":false,"position":20,"left":2413,"right":2409},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2410,"text":"+\t * If the path happens to be a Gather or GatherMerge path, we'd like to","html":"+\u003cspan class=\"pl-c\"\u003e\t * If the path happens to be a Gather \u003cspan class=\"x x-first x-last\"\u003eor GatherMerge \u003c/span\u003epath, we'd like to\u003c/span\u003e","displayNoNewLineWarning":false,"position":21,"left":2413,"right":2410},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2411,"text":"+\t * arrange for the subpath to return the required target list so that","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003earrange for the \u003c/span\u003esubpath to return the required target list so that\u003c/span\u003e","displayNoNewLineWarning":false,"position":22,"left":2413,"right":2411},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2412,"text":"+\t * workers can help project. But if there is something that is not","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003eworkers can help \u003c/span\u003eproject. But if there is something that is not\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":2413,"right":2412},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2413,"text":"+\t * parallel-safe in the target expressions, then we can't.","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003eparallel-safe in the \u003c/span\u003etarget expressions, then we can't.\u003c/span\u003e","displayNoNewLineWarning":false,"position":24,"left":2413,"right":2413},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2414,"text":" \t */","html":" \u003cspan class=pl-c\u003e\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":2414,"right":2414},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2415,"text":"-\tif (IsA(path, GatherPath) \u0026\u0026","html":"-\t\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-en\"\u003eIsA\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003epath\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eGatherPath\u003c/span\u003e) \u003cspan class=\"pl-c1\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":26,"left":2415,"right":2414},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2415,"text":"+\tif ((IsA(path, GatherPath) || IsA(path, GatherMergePath)) \u0026\u0026","html":"+\t\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"x x-first x-last\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eIsA\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003epath\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eGatherPath\u003c/span\u003e\u003cspan class=\"x x-first\"\u003e) \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003e||\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-en x\"\u003eIsA\u003c/span\u003e\u003cspan class=\"x\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003epath\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003eGatherMergePath\u003c/span\u003e\u003cspan class=\"x x-last\"\u003e)\u003c/span\u003e) \u003cspan class=\"pl-c1\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":27,"left":2415,"right":2415},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2416,"text":" \t\tis_parallel_safe(root, (Node *) target-\u003eexprs))","html":" \t\t\u003cspan class=pl-en\u003eis_parallel_safe\u003c/span\u003e(\u003cspan class=pl-s1\u003eroot\u003c/span\u003e, (\u003cspan class=pl-smi\u003eNode\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003etarget\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eexprs\u003c/span\u003e))","displayNoNewLineWarning":false,"position":28,"left":2416,"right":2416},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2417,"text":" \t{","html":" \t{","displayNoNewLineWarning":false,"position":29,"left":2417,"right":2417},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2418,"text":"-\t\tGatherPath *gpath = (GatherPath *) path;","html":"-\t\t\u003cspan class=pl-smi\u003eGatherPath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003egpath\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003eGatherPath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003epath\u003c/span\u003e;","displayNoNewLineWarning":false,"position":30,"left":2418,"right":2417},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2419,"text":"-","html":"-","displayNoNewLineWarning":false,"position":31,"left":2419,"right":2417},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2418,"text":" \t\t/*","html":" \t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":32,"left":2420,"right":2418},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2419,"text":" \t\t * We always use create_projection_path here, even if the subpath is","html":" \u003cspan class=pl-c\u003e\t\t * We always use create_projection_path here, even if the subpath is\u003c/span\u003e","displayNoNewLineWarning":false,"position":33,"left":2421,"right":2419},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2420,"text":" \t\t * projection-capable, so as to avoid modifying the subpath in place.","html":" \u003cspan class=pl-c\u003e\t\t * projection-capable, so as to avoid modifying the subpath in place.\u003c/span\u003e","displayNoNewLineWarning":false,"position":34,"left":2422,"right":2420},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2421,"text":" \t\t * It seems unlikely at present that there could be any other","html":" \u003cspan class=pl-c\u003e\t\t * It seems unlikely at present that there could be any other\u003c/span\u003e","displayNoNewLineWarning":false,"position":35,"left":2423,"right":2421},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2422,"text":" \t\t * references to the subpath, but better safe than sorry.","html":" \u003cspan class=pl-c\u003e\t\t * references to the subpath, but better safe than sorry.\u003c/span\u003e","displayNoNewLineWarning":false,"position":36,"left":2424,"right":2422},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2423,"text":" \t\t *","html":" \u003cspan class=pl-c\u003e\t\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":37,"left":2425,"right":2423},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2426,"text":"-\t\t * Note that we don't change the GatherPath's cost estimates; it might","html":"-\u003cspan class=\"pl-c\"\u003e\t\t * Note that we don't change the \u003cspan class=\"x x-first x-last\"\u003eGatherPath\u003c/span\u003e's cost estimates; it might\u003c/span\u003e","displayNoNewLineWarning":false,"position":38,"left":2426,"right":2423},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2424,"text":"+\t\t * Note that we don't change the parallel path's cost estimates; it might","html":"+\u003cspan class=\"pl-c\"\u003e\t\t * Note that we don't change the \u003cspan class=\"x x-first x-last\"\u003eparallel path\u003c/span\u003e's cost estimates; it might\u003c/span\u003e","displayNoNewLineWarning":false,"position":39,"left":2426,"right":2424},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2425,"text":" \t\t * be appropriate to do so, to reflect the fact that the bulk of the","html":" \u003cspan class=pl-c\u003e\t\t * be appropriate to do so, to reflect the fact that the bulk of the\u003c/span\u003e","displayNoNewLineWarning":false,"position":40,"left":2427,"right":2425},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2426,"text":" \t\t * target evaluation will happen in workers.","html":" \u003cspan class=pl-c\u003e\t\t * target evaluation will happen in workers.\u003c/span\u003e","displayNoNewLineWarning":false,"position":41,"left":2428,"right":2426},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2427,"text":" \t\t */","html":" \u003cspan class=pl-c\u003e\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":42,"left":2429,"right":2427},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2430,"text":"-\t\tgpath-\u003esubpath = (Path *)","html":"-\t\t\u003cspan class=pl-s1\u003egpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003ePath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e)","displayNoNewLineWarning":false,"position":43,"left":2430,"right":2427},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2431,"text":"-\t\t\tcreate_projection_path(root,","html":"-\t\t\t\u003cspan class=pl-en\u003ecreate_projection_path\u003c/span\u003e(\u003cspan class=pl-s1\u003eroot\u003c/span\u003e,","displayNoNewLineWarning":false,"position":44,"left":2431,"right":2427},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2432,"text":"-\t\t\t\t\t\t\t\t gpath-\u003esubpath-\u003eparent,","html":"-\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003egpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparent\u003c/span\u003e,","displayNoNewLineWarning":false,"position":45,"left":2432,"right":2427},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2433,"text":"-\t\t\t\t\t\t\t\t gpath-\u003esubpath,","html":"-\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003egpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e,","displayNoNewLineWarning":false,"position":46,"left":2433,"right":2427},{"stylingDirective":null,"type":"DELETION","blobLineNumber":2434,"text":"-\t\t\t\t\t\t\t\t target);","html":"-\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003etarget\u003c/span\u003e);","displayNoNewLineWarning":false,"position":47,"left":2434,"right":2427},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2428,"text":"+\t\tif (IsA(path, GatherPath))","html":"+\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eIsA\u003c/span\u003e(\u003cspan class=pl-s1\u003epath\u003c/span\u003e, \u003cspan class=pl-s1\u003eGatherPath\u003c/span\u003e))","displayNoNewLineWarning":false,"position":48,"left":2434,"right":2428},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2429,"text":"+\t\t{","html":"+\t\t{","displayNoNewLineWarning":false,"position":49,"left":2434,"right":2429},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2430,"text":"+\t\t\tGatherPath *gpath = (GatherPath *) path;","html":"+\t\t\t\u003cspan class=pl-smi\u003eGatherPath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003egpath\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003eGatherPath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003epath\u003c/span\u003e;","displayNoNewLineWarning":false,"position":50,"left":2434,"right":2430},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2431,"text":"+","html":"+","displayNoNewLineWarning":false,"position":51,"left":2434,"right":2431},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2432,"text":"+\t\t\tgpath-\u003esubpath = (Path *)","html":"+\t\t\t\u003cspan class=pl-s1\u003egpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003ePath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e)","displayNoNewLineWarning":false,"position":52,"left":2434,"right":2432},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2433,"text":"+\t\t\t\tcreate_projection_path(root,","html":"+\t\t\t\t\u003cspan class=pl-en\u003ecreate_projection_path\u003c/span\u003e(\u003cspan class=pl-s1\u003eroot\u003c/span\u003e,","displayNoNewLineWarning":false,"position":53,"left":2434,"right":2433},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2434,"text":"+\t\t\t\t\t\t\t\t\t gpath-\u003esubpath-\u003eparent,","html":"+\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003egpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparent\u003c/span\u003e,","displayNoNewLineWarning":false,"position":54,"left":2434,"right":2434},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2435,"text":"+\t\t\t\t\t\t\t\t\t gpath-\u003esubpath,","html":"+\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003egpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e,","displayNoNewLineWarning":false,"position":55,"left":2434,"right":2435},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2436,"text":"+\t\t\t\t\t\t\t\t\t target);","html":"+\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003etarget\u003c/span\u003e);","displayNoNewLineWarning":false,"position":56,"left":2434,"right":2436},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2437,"text":"+\t\t}","html":"+\t\t}","displayNoNewLineWarning":false,"position":57,"left":2434,"right":2437},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2438,"text":"+\t\telse","html":"+\t\t\u003cspan class=pl-k\u003eelse\u003c/span\u003e","displayNoNewLineWarning":false,"position":58,"left":2434,"right":2438},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2439,"text":"+\t\t{","html":"+\t\t{","displayNoNewLineWarning":false,"position":59,"left":2434,"right":2439},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2440,"text":"+\t\t\tGatherMergePath *gmpath = (GatherMergePath *) path;","html":"+\t\t\t\u003cspan class=pl-smi\u003eGatherMergePath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003egmpath\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003eGatherMergePath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003epath\u003c/span\u003e;","displayNoNewLineWarning":false,"position":60,"left":2434,"right":2440},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2441,"text":"+","html":"+","displayNoNewLineWarning":false,"position":61,"left":2434,"right":2441},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2442,"text":"+\t\t\tgmpath-\u003esubpath = (Path *)","html":"+\t\t\t\u003cspan class=pl-s1\u003egmpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-smi\u003ePath\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e)","displayNoNewLineWarning":false,"position":62,"left":2434,"right":2442},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2443,"text":"+\t\t\t\tcreate_projection_path(root,","html":"+\t\t\t\t\u003cspan class=pl-en\u003ecreate_projection_path\u003c/span\u003e(\u003cspan class=pl-s1\u003eroot\u003c/span\u003e,","displayNoNewLineWarning":false,"position":63,"left":2434,"right":2443},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2444,"text":"+\t\t\t\t\t\t\t\t\t gmpath-\u003esubpath-\u003eparent,","html":"+\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003egmpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparent\u003c/span\u003e,","displayNoNewLineWarning":false,"position":64,"left":2434,"right":2444},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2445,"text":"+\t\t\t\t\t\t\t\t\t gmpath-\u003esubpath,","html":"+\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003egmpath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003esubpath\u003c/span\u003e,","displayNoNewLineWarning":false,"position":65,"left":2434,"right":2445},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2446,"text":"+\t\t\t\t\t\t\t\t\t target);","html":"+\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003etarget\u003c/span\u003e);","displayNoNewLineWarning":false,"position":66,"left":2434,"right":2446},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2447,"text":"+\t\t}","html":"+\t\t}","displayNoNewLineWarning":false,"position":67,"left":2434,"right":2447},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2448,"text":" \t}","html":" \t}","displayNoNewLineWarning":false,"position":68,"left":2435,"right":2448},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2449,"text":" \telse if (path-\u003eparallel_safe \u0026\u0026","html":" \t\u003cspan class=pl-k\u003eelse\u003c/span\u003e \u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003epath\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparallel_safe\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":69,"left":2436,"right":2449},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2450,"text":" \t\t\t !is_parallel_safe(root, (Node *) target-\u003eexprs))","html":" \t\t\t !\u003cspan class=pl-en\u003eis_parallel_safe\u003c/span\u003e(\u003cspan class=pl-s1\u003eroot\u003c/span\u003e, (\u003cspan class=pl-smi\u003eNode\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e) \u003cspan class=pl-s1\u003etarget\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eexprs\u003c/span\u003e))","displayNoNewLineWarning":false,"position":70,"left":2437,"right":2450}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":3832,"linesChanged":45,"newTreeEntry":{"lineCount":3832,"path":"src/backend/optimizer/util/pathnode.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/optimizer/util/pathnode.c","mode":100644},"linesAdded":29,"linesDeleted":16,"path":"src/backend/optimizer/util/pathnode.c","pathDigest":"5a309cd0bd00599924f43e0f17e59b15cc81b2f44571303cbb30fb8a240cd09d","status":"MODIFIED","truncatedReason":null,"oldOid":"e64861c79bda659ee384bc253f651401f953dadc","newOid":"44ae64c388bde6e4b077272570c84dedfb17bed3","copilotChatReference":null,"deletedSha":"e64861c79bda659ee384bc253f651401f953dadc","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":374," 8000 text":"@@ -375,6 +375,31 @@ select count(*) from tenk1 group by twenty;","html":"@@ -375,6 +375,31 @@ select count(*) from tenk1 group by twenty;","displayNoNewLineWarning":false,"position":0,"left":374,"right":374},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":375,"text":" 500","html":" 500","displayNoNewLineWarning":false,"position":1,"left":375,"right":375},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":376,"text":" (20 rows)","html":" (20 rows)","displayNoNewLineWarning":false,"position":2,"left":376,"right":376},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":377,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":377,"right":377},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":378,"text":"+--test expressions in targetlist are pushed down for gather merge","html":"+--test expressions in targetlist are pushed down for gather merge","displayNoNewLineWarning":false,"position":4,"left":377,"right":378},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":379,"text":"+create or replace function simple_func(var1 integer) returns integer","html":"+create or replace function simple_func(var1 integer) returns integer","displayNoNewLineWarning":false,"position":5,"left":377,"right":379},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":380,"text":"+as $$","html":"+as $$","displayNoNewLineWarning":false,"position":6,"left":377,"right":380},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":381,"text":"+begin","html":"+begin","displayNoNewLineWarning":false,"position":7,"left":377,"right":381},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":382,"text":"+ return var1 + 10;","html":"+ return var1 + 10;","displayNoNewLineWarning":false,"position":8,"left":377,"right":382},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":383,"text":"+end;","html":"+end;","displayNoNewLineWarning":false,"position":9,"left":377,"right":383},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":384,"text":"+$$ language plpgsql PARALLEL SAFE;","html":"+$$ language plpgsql PARALLEL SAFE;","displayNoNewLineWarning":false,"position":10,"left":377,"right":384},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":385,"text":"+explain (costs off, verbose)","html":"+explain (costs off, verbose)","displayNoNewLineWarning":false,"position":11,"left":377,"right":385},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":386,"text":"+ select ten, simple_func(ten) from tenk1 where ten \u003c 100 order by ten;","html":"+ select ten, simple_func(ten) from tenk1 where ten \u0026lt; 100 order by ten;","displayNoNewLineWarning":false,"position":12,"left":377,"right":386},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":387,"text":"+ QUERY PLAN ","html":"+ QUERY PLAN ","displayNoNewLineWarning":false,"position":13,"left":377,"right":387},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":388,"text":"+-----------------------------------------------------","html":"+-----------------------------------------------------","displayNoNewLineWarning":false,"position":14,"left":377,"right":388},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":389,"text":"+ Gather Merge","html":"+ Gather Merge","displayNoNewLineWarning":false,"position":15,"left":377,"right":389},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":390,"text":"+ Output: ten, (simple_func(ten))","html":"+ Output: ten, (simple_func(ten))","displayNoNewLineWarning":false,"position":16,"left":377,"right":390},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":391,"text":"+ Workers Planned: 4","html":"+ Workers Planned: 4","displayNoNewLineWarning":false,"position":17,"left":377,"right":391},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":392,"text":"+ -\u003e Result","html":"+ -\u0026gt; Result","displayNoNewLineWarning":false,"position":18,"left":377,"right":392},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":393,"text":"+ Output: ten, simple_func(ten)","html":"+ Output: ten, simple_func(ten)","displayNoNewLineWarning":false,"position":19,"left":377,"right":393},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":394,"text":"+ -\u003e Sort","html":"+ -\u0026gt; Sort","displayNoNewLineWarning":false,"position":20,"left":377,"right":394},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":395,"text":"+ Output: ten","html":"+ Output: ten","displayNoNewLineWarning":false,"position":21,"left":377,"right":395},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":396,"text":"+ Sort Key: tenk1.ten","html":"+ Sort Key: tenk1.ten","displayNoNewLineWarning":false,"position":22,"left":377,"right":396},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":397,"text":"+ -\u003e Parallel Seq Scan on public.tenk1","html":"+ -\u0026gt; Parallel Seq Scan on public.tenk1","displayNoNewLineWarning":false,"position":23,"left":377,"right":397},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":398,"text":"+ Output: ten","html":"+ Output: ten","displayNoNewLineWarning":false,"position":24,"left":377,"right":398},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":399,"text":"+ Filter: (tenk1.ten \u003c 100)","html":"+ Filter: (tenk1.ten \u0026lt; 100)","displayNoNewLineWarning":false,"position":25,"left":377,"right":399},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":400,"text":"+(11 rows)","html":"+(11 rows)","displayNoNewLineWarning":false,"position":26,"left":377,"right":400},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":401,"text":"+","html":"+","displayNoNewLineWarning":false,"position":27,"left":377,"right":401},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":402,"text":"+drop function simple_func(integer);","html":"+drop function simple_func(integer);","displayNoNewLineWarning":false,"position":28,"left":377,"right":402},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":403,"text":" --test rescan behavior of gather merge","html":" --test rescan behavior of gather merge","displayNoNewLineWarning":false,"position":29,"left":378,"right":403},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":404,"text":" set enable_material = false;","html":" set enable_material = false;","displayNoNewLineWarning":false,"position":30,"left":379,"right":404},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":405,"text":" explain (costs off)","html":" explain (costs off)","displayNoNewLineWarning":false,"position":31,"left":380,"right":405}],"diffNumber":2,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":572,"linesChanged":25,"newTreeEntry":{"lineCount":572,"path":"src/test/regress/expected/select_parallel.out","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/regress/expected/select_parallel.out","mode":100644},"linesAdded":25,"linesDeleted":0,"path":"src/test/regress/expected/select_parallel.out","pathDigest":"4a062ac293b325d8c96fa560293469fe73c426708dbd8c5f2f3d893d214868e1","status":"MODIFIED","truncatedReason":null,"oldOid":"e64861c79bda659ee384bc253f651401f953dadc","newOid":"44ae64c388bde6e4b077272570c84dedfb17bed3","copilotChatReference":null,"deletedSha":"e64861c79bda659ee384bc253f651401f953dadc","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":143,"text":"@@ -144,6 +144,19 @@ explain (costs off)","html":"@@ -144,6 +144,19 @@ explain (costs off)","displayNoNewLineWarning":false,"position":0,"left":143,"right":143},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":144,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":1,"left":144,"right":144},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":145,"text":" select count(*) from tenk1 group by twenty;","html":" \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ecount\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e) \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e tenk1 \u003cspan class=\"pl-k\"\u003egroup by\u003c/span\u003e twenty;","displayNoNewLineWarning":false,"position":2,"left":145,"right":145},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":146,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":146,"right":146},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":147,"text":"+--test expressions in targetlist are pushed down for gather merge","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003etest expressions in targetlist are pushed down for gather merge\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":146,"right":147},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":148,"text":"+create or replace function simple_func(var1 integer) returns integer","html":"+\u003cspan class=\"pl-k\"\u003ecreate or replace\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efunction\u003c/span\u003e \u003cspan class=\"pl-en\"\u003esimple_func\u003c/span\u003e(var1 \u003cspan class=\"pl-k\"\u003einteger\u003c/span\u003e) returns \u003cspan class=\"pl-k\"\u003einteger\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":146,"right":148},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":149,"text":"+as $$","html":"+\u003cspan class=\"pl-k\"\u003eas\u003c/span\u003e $$","displayNoNewLineWarning":false,"position":6,"left":146,"right":149},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":150,"text":"+begin","html":"+\u003cspan class=\"pl-k\"\u003ebegin\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":146,"right":150},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":151,"text":"+ return var1 + 10;","html":"+ return var1 \u003cspan class=\"pl-k\"\u003e+\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e10\u003c/span\u003e;","displayNoNewLineWarning":false,"position":8,"left":146,"right":151},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":152,"text":"+end;","html":"+end;","displayNoNewLineWarning":false,"position":9,"left":146,"right":152},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":153,"text":"+$$ language plpgsql PARALLEL SAFE;","html":"+$$ language plpgsql PARALLEL SAFE;","displayNoNewLineWarning":false,"position":10,"left":146,"right":153},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":154,"text":"+","html":"+","displayNoNewLineWarning":false,"position":11,"left":146,"right":154},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":155,"text":"+explain (costs off, verbose)","html":"+explain (costs off, verbose)","displayNoNewLineWarning":false,"position":12,"left":146,"right":155},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":156,"text":"+ select ten, simple_func(ten) from tenk1 where ten \u003c 100 order by ten;","html":"+ \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e ten, simple_func(ten) \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e tenk1 \u003cspan class=\"pl-k\"\u003ewhere\u003c/span\u003e ten \u003cspan class=\"pl-k\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e100\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eorder by\u003c/span\u003e ten;","displayNoNewLineWarning":false,"position":13,"left":146,"right":156},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":157,"text":"+","html":"+","displayNoNewLineWarning":false,"position":14,"left":146,"right":157},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":158,"text":"+drop function simple_func(integer);","html":"+\u003cspan class=\"pl-k\"\u003edrop\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efunction\u003c/span\u003e simple_func(\u003cspan class=\"pl-k\"\u003einteger\u003c/span\u003e);","displayNoNewLineWarning":false,"position":15,"left":146,"right":158},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":159,"text":"+","html":"+","displayNoNewLineWarning":false,"position":16,"left":146,"right":159},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":160,"text":" --test rescan behavior of gather merge","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003etest rescan behavior of gather merge\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":147,"right":160},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":161,"text":" set enable_material = false;","html":" \u003cspan class=\"pl-k\"\u003eset\u003c/span\u003e enable_material \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e false;","displayNoNewLineWarning":false,"position":18,"left":148,"right":161},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":162,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":19,"left":149,"right":162}],"diffNumber":3,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":240,"linesChanged":13,"newTreeEntry":{"lineCount":240,"path":"src/test/regress/sql/select_parallel.sql","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/regress/sql/select_parallel.sql","mode":100644},"linesAdded":13,"linesDeleted":0,"path":"src/test/regress/sql/select_parallel.sql","pathDigest":"d935600540f8b0b1f82f1c7b35823e6a09f92fabf96352cb4c17928ad5bda3fa","status":"MODIFIED","truncatedReason":null,"oldOid":"e64861c79bda659ee384bc253f651401f953dadc","newOid":"44ae64c388bde6e4b077272570c84dedfb17bed3","copilotChatReference":null,"deletedSha":"e64861c79bda659ee384bc253f651401f953dadc","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/44ae64c388bde6e4b077272570c84dedfb17bed3","fileTreeExpanded":true,"headerInfo":{"additions":69,"deletions":17,"filesChanged":4,"filesChangedString":"4"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":4,"truncated":false,"byteCount":4766,"lineShownCount":133},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"m6Q6aribeTJJoXIEUZIMJ57hyqrIGcj1Qy5aVIFMW3PDyFX_MmNw8bwF6XTe4UOSsfcYDCl2UVCboRprLvj8PQ"},"/users/diffview?diff=unified":{"post":"gdkxedlvqc7g7P3mWlwGehAmefqS3fWDvgKno9HP5P_ZtV7sU5egDRVIZpbVL0nPPzCrXHOybCZmjeecfntDsQ"},"/notifications/thread":{"post":"xv9TVyaZNGIoJbtaiw8CENYZArPbxg1NGb3DR41YZdyf38Ma6a2_qCoqd_JFcUZzImwz6sww30mRnTHKnSPtFA"}}},"title":"Push target list evaluation through Gather Merge. · postgres/postgres@44ae64c","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"react_diff_line_type_character_correction":true}}}

Commit 44ae64c

Browse files
committed
Push target list evaluation through Gather Merge.
We already do this for Gather, but it got overlooked for Gather Merge. Amit Kapila, with review and minor revisions by Rushabh Lathia and by me. Discussion: http://postgr.es/m/CAA4eK1KUC5Uyu7qaifxrjpHxbSeoQh3yzwN3bThnJsmJcZ-qtA@mail.gmail.com
1 parent e64861c commit 44ae64c

File tree

4 files changed

+69
-17
lines changed

4 files changed

+69
-17
lines changed

src/backend/optimizer/plan/planner.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5060,7 +5060,8 @@ create_ordered_paths(PlannerInfo *root,
50605060
path = (Path *)
50615061
create_gather_merge_path(root, ordered_rel,
50625062
path,
5063-
target, root->sort_pathkeys, NULL,
5063+
path->pathtarget,
5064+
root->sort_pathkeys, NULL,
50645065
&total_groups);
50655066

50665067
/* Add projection step if needed */

src/backend/optimizer/util/pathnode.c

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,9 +2368,9 @@ create_projection_path(PlannerInfo *root,
23682368
* knows that the given path isn't referenced elsewhere and so can be modified
23692369
* in-place.
23702370
*
2371-
* If the input path is a GatherPath, we try to push the new target down to
2372-
* its input as well; this is a yet more invasive modification of the input
2373-
* path, which create_projection_path() can't do.
2371+
* If the input path is a GatherPath or GatherMergePath, we try to push the
2372+
* new target down to its input as well; this is a yet more invasive
2373+
* modification of the input path, which create_projection_path() can't do.
23742374
*
23752375
* Note that we mustn't change the source path's parent link; so when it is
23762376
* add_path'd to "rel" things will be a bit inconsistent. So far that has
@@ -2407,31 +2407,44 @@ apply_projection_to_path(PlannerInfo *root,
24072407
(target->cost.per_tuple - oldcost.per_tuple) * path->rows;
24082408

24092409
/*
2410-
* If the path happens to be a Gather path, we'd like to arrange for the
2411-
* subpath to return the required target list so that workers can help
2412-
* project. But if there is something that is not parallel-safe in the
2413-
* target expressions, then we can't.
2410+
* If the path happens to be a Gather or GatherMerge path, we'd like to
2411+
* arrange for the subpath to return the required target list so that
2412+
* workers can help project. But if there is something that is not
2413+
* parallel-safe in the target expressions, then we can't.
24142414
*/
2415-
if (IsA(path, GatherPath) &&
2415+
if ((IsA(path, GatherPath) || IsA(path, GatherMergePath)) &&
24162416
is_parallel_safe(root, (Node *) target->exprs))
24172417
{
2418-
GatherPath *gpath = (GatherPath *) path;
2419-
24202418
/*
24212419
* We always use create_projection_path here, even if the subpath is
24222420
* projection-capable, so as to avoid modifying the subpath in place.
24232421
* It seems unlikely at present that there could be any other
24242422
* references to the subpath, but better safe than sorry.
24252423
*
2426-
* Note that we don't change the GatherPath's cost estimates; it might
2424+
* Note that we don't change the parallel path's cost estimates; it might
24272425
* be appropriate to do so, to reflect the fact that the bulk of the
24282426
* target evaluation will happen in workers.
24292427
*/
2430-
gpath->subpath = (Path *)
2431-
create_projection_path(root,
2432-
gpath->subpath->parent,
2433-
gpath->subpath,
2434-
target);
2428+
if (IsA(path, GatherPath))
2429+
{
2430+
GatherPath *gpath = (GatherPath *) path;
2431+
2432+
gpath->subpath = (Path *)
2433+
create_projection_path(root,
2434+
gpath->subpath->parent,
2435+
gpath->subpath,
2436+
target);
2437+
}
2438+
else
2439+
{
2440+
GatherMergePath *gmpath = (GatherMergePath *) path;
2441+
2442+
gmpath->subpath = (Path *)
2443+
create_projection_path(root,
2444+
gmpath->subpath->parent,
2445+
gmpath->subpath,
2446+
target);
2447+
}
24352448
}
24362449
else if (path->parallel_safe &&
24372450
!is_parallel_safe(root, (Node *) target->exprs))

src/test/regress/expected/select_parallel.out

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,31 @@ select count(*) from tenk1 group by twenty;
375375
500
376376
(20 rows)
377377

378+
--test expressions in targetlist are pushed down for gather merge
379+
create or replace function simple_func(var1 integer) returns integer
380+
as $$
381+
begin
382+
return var1 + 10;
383+
end;
384+
$$ language plpgsql PARALLEL SAFE;
385+
explain (costs off, verbose)
386+
select ten, simple_func(ten) from tenk1 where ten < 100 order by ten;
387+
QUERY PLAN
388+
-----------------------------------------------------
389+
Gather Merge
390+
Output: ten, (simple_func(ten))
391+
Workers Planned: 4
392+
-> Result
393+
Output: ten, simple_func(ten)
394+
-> Sort
395+
Output: ten
396+
Sort Key: tenk1.ten
397+
-> Parallel Seq Scan on public.tenk1
398+
Output: ten
399+
Filter: (tenk1.ten < 100)
400+
(11 rows)
401+
402+
drop function simple_func(integer);
378403
--test rescan behavior of gather merge
379404
set enable_material = false;
380405
explain (costs off)

src/test/regress/sql/select_parallel.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,19 @@ explain (costs off)
144144

145145
select count(*) from tenk1 group by twenty;
146146

147+
--test expressions in targetlist are pushed down for gather merge
148+
create or replace function simple_func(var1 integer) returns integer
149+
as $$
150+
begin
151+
return var1 + 10;
152+
end;
153+
$$ language plpgsql PARALLEL SAFE;
154+
155+
explain (costs off, verbose)
156+
select ten, simple_func(ten) from tenk1 where ten < 100 order by ten;
157+
158+
drop function simple_func(integer);
159+
147160
--test rescan behavior of gather merge
148161
set enable_material = false;
149162

0 commit comments

Comments
 (0)
0