Re: can't get rid of unnesesary SORT step in explain plan for hash join

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: can't get rid of unnesesary SORT step in explain plan for hash join
Дата
Msg-id 8987.989849829@sss.pgh.pa.us
обсуждение исходный текст
Ответ на can't get rid of unnesesary SORT step in explain plan for hash join  (Alexey Nalbat <alexey@price.ru>)
Список pgsql-sql
Alexey Nalbat <alexey@price.ru> writes:
> While executing this query postgres at first creates hash on table
> "resellers", then get from index "products_mcr" for rows with
> "m_id=123" already ordered (!!!)  pairs "c_id,r_id", for each that
> pair it checks join condition using hash. If postgers behaves like
> this then the result of this hash join is already sorted, and extra
> "Sort" is not needed.

No, because the hash step might choose to divide its processing into
multiple "batches", thereby destroying the sort order.  The outer path's
ordering is preserved only in relatively small test cases...
        regards, tom lane


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

Предыдущее
От: John Scott
Дата:
Сообщение: unwritable /tmp causes initdb to crash
Следующее
От: Srikanth Rao
Дата:
Сообщение: Counting rows in a table