Allow DISTINCT to use Incremental Sort

Поиск
Список
Период
Сортировка
От David Rowley
Тема Allow DISTINCT to use Incremental Sort
Дата
Msg-id CAApHDvo8Lz2H=42urBbfP65LTcEUOh288MT7DsG2_EWtW1AXHQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Allow DISTINCT to use Incremental Sort  (Richard Guo <guofenglinux@gmail.com>)
Список pgsql-hackers
While working on the regression tests added in a14a58329, I noticed
that DISTINCT does not make use of Incremental Sort.  It'll only ever
do full sorts on the cheapest input path or make use of a path that's
already got the required pathkeys.  Also, I see that
create_final_distinct_paths() is a little quirky and if the cheapest
input path happens to be sorted, it'll add_path() the same path twice,
which seems like a bit of a waste of effort. That could happen if say
enable_seqscan is off or if a Merge Join is the cheapest join method.

Additionally, the parallel DISTINCT code looks like it should also get
the same treatment.  I see that I'd coded this to only add a unique
path atop of a presorted path and it never considers sorting the
cheapest partial path.  I've adjusted that in the attached and also
made it consider incremental sorting any path with presorted keys.

Please see the attached patch.

David

Вложения

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

Предыдущее
От: Esteban Zimanyi
Дата:
Сообщение: How to define template types in PostgreSQL
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Notify downstream to discard the streamed transaction which was aborted due to crash.