Re: More records after sort

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: More records after sort
Дата
Msg-id 368621.1626791677@sss.pgh.pa.us
обсуждение исходный текст
Ответ на More records after sort  (Nicolas Seinlet <nicolas@seinlet.com>)
Ответы Re: More records after sort  (Nicolas Seinlet <nicolas@seinlet.com>)
Список pgsql-general
Nicolas Seinlet <nicolas@seinlet.com> writes:
> I'm facing a strange behaviour and I don't understand why. From a wider query
plan, https://explain.dalibo.com/plan/7yh ,atable is scanned and filter based on its primary key, returning 98 records.
Then,those records are sorted on another field, and the output is 758,247,643 records. 

You haven't showed us the whole plan; tsk tsk.

However, I'm going to bet that this sort is the inner input of a merge
join, and that the apparent "extra" tuples are caused by the merge backing
up and rescanning the sort result to deal with duplicate join keys in its
outer input.  There must be a heck of a lot of duplicates.  The planner
would typically avoid using merge join if it knew that, so I'm wondering
if you have up-to-date statistics for the outer side of the join.

            regards, tom lane



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

Предыдущее
От: Nicolas Seinlet
Дата:
Сообщение: More records after sort
Следующее
От: Nicolas Seinlet
Дата:
Сообщение: Re: More records after sort