From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> |
Cc: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Top-N sorts verses parallelism |
Date: | 2017-12-19 15:45:25 |
Message-ID: | CA+TgmoaahjDNTUyC=37xNL+WZJEi1urfqJAR7kXqehA=f=taUg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Dec 19, 2017 at 6:54 AM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Mon, Dec 18, 2017 at 9:29 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> I went through the callers to create_sort_path and the only one that
>> looks like it can pass a limit is the one you and Jeff already
>> identified. So I think the question is just whether
>> create_gather_merge_path needs a similar fix.
>
> I might be missing something, but it looks like there are no cases
> where we have a limit_tuples value we could use AND we're relying on
> create_gather_merge_path's own ability to create sort paths. So I
> suspect there is no reason to change create_gather_merge_path itself
> to deal with tuple limits. I looked at each of its callers:
>
> 1. create_ordered_paths is the case the patch posted earlier covers:
> it has a useful limit_tuples value but it creates the sort path itself
> first, so there is no need for create_gather_merge_path to be aware of
> it.
>
> 2. create_grouping_paths doesn't have limit_tuples value because
> grouping always inhibits limits.
>
> 3. generate_gather_paths is in turn called by:
>
> 3.1. standard_joinsearch can't use limits (at least in general) since
> it's dealing with a join.
>
> 3.2. geco's merge_clump is also about joins, so ditto.
>
> 3.3. set_rel_pathlist will consider only pathkeys from existing index
> scans that set_plain_rel_pathlist found, not creating new pathkeys by
> sorting.
Well, it might be good future-proofing, but at least it's good to know
that it's not a active bug. I pushed your earlier fix, which turns
out to be a revert of commit
dc02c7bca4dccf7de278cdc6b3325a829e75b252.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2017-12-19 15:46:18 | Re: Add hint about replication slots when nearing wraparound |
Previous Message | Robert Haas | 2017-12-19 15:31:04 | Re: [HACKERS] parallel.c oblivion of worker-startup failures |