Re: [HACKERS] Removing useless DISTINCT clauses

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [HACKERS] Removing useless DISTINCT clauses
Дата
Msg-id CAKJS1f8VXZOFwWf++H5dE2g5-Oskj8+9ypfMUNhWJNN=NR9uWA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Removing useless DISTINCT clauses  (Jeff Janes <jeff.janes@gmail.com>)
Ответы Re: [HACKERS] Removing useless DISTINCT clauses  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-hackers
Hi Jeff,

Thanks for looking at the patch.

On 6 January 2018 at 10:34, Jeff Janes <jeff.janes@gmail.com> wrote:
> Couldn't the Unique node be removed entirely?  If k is a primary key, you
> can't have duplicates in need of removal.

It probably could be, if there were no joins, but any join could
duplicate those rows, so we'd only be able to do that if there were no
joins, and I'm not sure we'd want to special case that. It seems just
too naive to be taken seriously. We could do a lot better...

> Or would that be a subject for a different patch?

Yeah, I'd rather do that fix properly, and do have ideas on how to,
just it's a lot more work (basically testing if the joins can
duplicate rows or not (unique joins++)).

> I think remove_functionally_dependant_groupclauses should have a more
> generic name, like remove_functionally_dependant_clauses.

It's been a while since I looked at this. I remember thinking
something similar at the time but I must have not changed it.

I'll look again and post an updated patch.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Creating backup history files for backups taken from standbys
Следующее
От: David Rowley
Дата:
Сообщение: Re: [HACKERS] Runtime Partition Pruning