From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: James Coleman <jtc331@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Consider low startup cost in add_partial_path
Date: Sun, 29 Sep 2019 00:37:41 +0200
Message-ID: <20190928223741.fllqcjhpv2zdbljr@development> (raw)
In-Reply-To: <CA+Tgmobcht8MM6sxZAxEEe+9aMcEja3OTp9p97gNbcW8ZhzBTw@mail.gmail.com>
References: <CAAaqYe-5HmM4ih6FWp2RNV9rruunfrFrLhqFXF_nrrNCPy1Zhg@mail.gmail.com>
<CA+Tgmobcht8MM6sxZAxEEe+9aMcEja3OTp9p97gNbcW8ZhzBTw@mail.gmail.com>
On Sat, Sep 28, 2019 at 12:16:05AM -0400, Robert Haas wrote:
>On Fri, Sep 27, 2019 at 2:24 PM James Coleman <jtc331@gmail.com> wrote:
>> Over in the incremental sort patch discussion we found [1] a case
>> where a higher cost plan ends up being chosen because a low startup
>> cost partial path is ignored in favor of a lower total cost partial
>> path and a limit is a applied on top of that which would normal favor
>> the lower startup cost plan.
>>
>> 45be99f8cd5d606086e0a458c9c72910ba8a613d originally added
>> `add_partial_path` with the comment:
>>
>> > Neither do we need to consider startup costs:
>> > parallelism is only used for plans that will be run to completion.
>> > Therefore, this routine is much simpler than add_path: it needs to
>> > consider only pathkeys and total cost.
>>
>> I'm not entirely sure if that is still true or not--I can't easily
>> come up with a scenario in which it's not, but I also can't come up
>> with an inherent reason why such a scenario cannot exist.
>
>I think I just didn't think carefully about the Limit case.
>
Thanks! In that case I suggest we treat it as a separate patch/fix,
independent of the incremental sort patch. I don't want to bury it in
that patch series, it's already pretty large.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, robertmhaas@gmail.com, jtc331@gmail.com
Subject: Re: Consider low startup cost in add_partial_path
In-Reply-To: <20190928223741.fllqcjhpv2zdbljr@development>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox