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 CAMbWs4-1Ui1WXpv2_t-ukGH29fVpxr++C_CD1UKj4--==HtyXg@mail.gmail.com
обсуждение исходный текст
Ответ на 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 Wed, Oct 12, 2022 at 5:19 PM David Rowley <dgrowleyml@gmail.com> wrote:
When all the distinct pathkeys are redundant then there can only be,
at most, 1 single distinct value. There may be many rows with that
value, but we can remove those extra ones with a LIMIT 1 rather than
troubling over needlessly uniquifing them.
 
I'm not sure if this case is common enough in practice, but since this
patch is very straightforward and adds no more costs, I think it's worth
doing.

I also have concerns about the 2 Limit nodes pointed by the comment
inside the patch. Maybe we can check with limit_needed() and manually
add the limit node only if there is no LIMIT clause in the origin query?

Thanks
Richard

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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: create subscription - improved warning message
Следующее
От: Tatsuo Ishii
Дата:
Сообщение: Re: make_ctags: use -I option to ignore pg_node_attr macro