Re: Plan weirdness. A sort produces more rows than the node beneath it

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Plan weirdness. A sort produces more rows than the node beneath it
Дата
Msg-id CAMkU=1xmXPZYmMqrxKDoYZzGcweiYcpR5dMbV-jWjQOdoF7Bmg@mail.gmail.com
обсуждение исходный текст
Ответ на Plan weirdness. A sort produces more rows than the node beneath it  (Dane Foster <studdugie@gmail.com>)
Ответы Re: Plan weirdness. A sort produces more rows than the node beneath it  (Dane Foster <studdugie@gmail.com>)
Список pgsql-performance
On Fri, Aug 4, 2023 at 11:00 AM Dane Foster <studdugie@gmail.com> wrote:
Hello,

I'm trying to understand a bit of weirdness in a plan output. There is a sort node above a sequential scan node where the scan node produces 26,026 rows yet the sort node above it produces 42,995,408. How is it possible to sort more data than you received?

This is normal for a merge join.  For every tie in the first input, the qualifying part of the 2nd input must be rescanned, and the rows are tallied again (in the sort node) each time they are rescanned. 
 
Cheers,

Jeff

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

Предыдущее
От: Dane Foster
Дата:
Сообщение: Plan weirdness. A sort produces more rows than the node beneath it
Следующее
От: Dane Foster
Дата:
Сообщение: Re: Plan weirdness. A sort produces more rows than the node beneath it