Re: Use LIMIT instead of Unique for DISTINCT when all distinct pathkeys are redundant

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: Use LIMIT instead of Unique for DISTINCT when all distinct pathkeys are redundant
Дата
Msg-id CAMbWs49M5oemdZ5n33qvyWzUzexz=Z305Z01JdBNJzEPqDto0Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Use LIMIT instead of Unique for DISTINCT when all distinct pathkeys are redundant  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Use LIMIT instead of Unique for DISTINCT when all distinct pathkeys are redundant  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers

On Thu, Oct 13, 2022 at 6:43 PM David Rowley <dgrowleyml@gmail.com> wrote:
On Thu, 13 Oct 2022 at 21:17, Richard Guo <guofenglinux@gmail.com> wrote:
>
> On Thu, Oct 13, 2022 at 2:48 PM David Rowley <dgrowleyml@gmail.com> wrote:
>> To stop the planner from adding that final sort, I opted to hack the
>> LimitPath's pathkeys to say that it's already sorted by the
>> PlannerInfo's sort_pathkeys.  That feels slightly icky, but it does
>> seem a little wasteful to initialise a sort node on every execution of
>> the plan to sort a single tuple.
>
>
> I don't get how this plan comes out. It seems not correct because Limit
> node above an unsorted path would give us an unpredictable row.

Actually, you're right. That manual setting of the pathkeys is an
unneeded remanent from a bug I fixed before sending out v2.  It can
just be removed.

I've attached the v3 patch.
 
The v3 patch looks good to me.

Thanks
Richard

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Support tls-exporter as channel binding for TLSv1.3
Следующее
От: Peter Smith
Дата:
Сообщение: Re: GUC values - recommended way to declare the C variables?