Re: Removing useless DISTINCT clauses

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Removing useless DISTINCT clauses
Дата
Msg-id 25619.1535076216@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Removing useless DISTINCT clauses  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: Removing useless DISTINCT clauses
Список pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:
> * David Rowley (david.rowley@2ndquadrant.com) wrote:
>> On 24 August 2018 at 11:34, Stephen Frost <sfrost@snowman.net> wrote:
>>> * David Rowley (david.rowley@2ndquadrant.com) wrote:
>>>> My personal opinion of only being able to completely remove the
>>>> DISTINCT when there's a single item in the rtable (or a single base
>>>> table) is that it's just too poor to bother with.

> Hm, so you're suggesting that this isn't the right place for this
> optimization to be implemented, even now, with the single-relation
> caveat?

There is no case where planner optimizations should depend on the length
of the rtable.  Full stop.

It could make sense to optimize if there is just one baserel in the join
tree --- although even that is best checked only after join removal.
As an example of the difference, such an optimization should be able to
optimize "select * from view" if the view contains just one base table.
The rtable will list both the view and the base table, but the view
is only hanging around for permissions-checking purposes; it should not
affect the planner's behavior.

I've not read the patch, but David's reaction makes it sound like its
processing is done too early.  There are right places and wrong places
to do most everything in the planner, and I do not wish to accept a
patch that does something in the wrong place.

            regards, tom lane


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

Предыдущее
От: Haribabu Kommi
Дата:
Сообщение: Re: Pluggable Storage - Andres's take
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Removing useless DISTINCT clauses