Re: Problem about postponing gathering partial paths for topmost scan/join rel - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Problem about postponing gathering partial paths for topmost scan/join rel
Date
Msg-id CAMbWs4-bbPocLuRb2+tL-BRz_fEZAuj7ZS=QdcM7uCe_qtw2uA@mail.gmail.com
Whole thread Raw
In response to Problem about postponing gathering partial paths for topmost scan/join rel  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Problem about postponing gathering partial paths for topmost scan/join rel
List pgsql-hackers

On Wed, Jul 28, 2021 at 3:42 PM Richard Guo <guofenglinux@gmail.com> wrote:
To fix this problem, I'm thinking we can leverage 'root->all_baserels'
to tell if we are at the topmost scan/join rel, something like:

--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -3041,7 +3041,7 @@ standard_join_search(PlannerInfo *root, int levels_needed, List *initial_rels)
                         * partial paths.  We'll do the same for the topmost scan/join rel
                         * once we know the final targetlist (see grouping_planner).
                         */
-                       if (lev < levels_needed)
+                       if (!bms_equal(rel->relids, root->all_baserels))
                                generate_useful_gather_paths(root, rel, false);


Any thoughts?

Attach a patch to include the fix described upthread. Would appreciate
any comments on this topic.

Thanks
Richard 
Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: A qsort template
Next
From: Dean Rasheed
Date:
Subject: Division by zero error in to_char(num, '9.9EEEE')