Re: Query rewrite(optimization) using constraints

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: Query rewrite(optimization) using constraints
Дата
Msg-id 20211008180111.GO27491@telsasoft.com
обсуждение исходный текст
Ответ на Query rewrite(optimization) using constraints  (Lily Liu <lilyliupku@gmail.com>)
Список pgsql-hackers
On Fri, Oct 08, 2021 at 10:24:33AM -0700, Lily Liu wrote:
> 1) Remove DISTINCT
> 
> A simple example is SELECT DISTINCT(name) FROM R. If there is a unique
> constraint on the name column. The DISTINCT keyword can be removed safely.
> Query plans without the DISTINCT keyword might be much cheaper since
> DISTINCT is expensive.

There's an ongoing discussion and patches for this here.

Erase the distinctClause if the result is unique by definition
https://commitfest.postgresql.org/35/2433/

Perhaps you could help to test or review the patch ?

-- 
Justin



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

Предыдущее
От: Max Shore
Дата:
Сообщение: ERROR: unexpected duplicate for tablespace 16389, relfilenode 484036
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Query rewrite(optimization) using constraints