From: | Dane Foster <studdugie(at)gmail(dot)com> |
---|---|
To: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
Cc: | psql-performance <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Plan weirdness. A sort produces more rows than the node beneath it |
Date: | 2023-08-04 15:09:09 |
Message-ID: | CA+WxinKkY7706Fbbg80KahH+ywaWWSCbk_tgXzyksZDEdbDb=A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Thanks for the explanation.
Dane
On Fri, Aug 4, 2023 at 11:07 AM Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> On Fri, Aug 4, 2023 at 11:00 AM Dane Foster <studdugie(at)gmail(dot)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
>
>>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-08-04 15:10:21 | Re: Plan weirdness. A sort produces more rows than the node beneath it |
Previous Message | Jeff Janes | 2023-08-04 15:07:19 | Re: Plan weirdness. A sort produces more rows than the node beneath it |