| From: | Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Rowley <dgrowleyml(at)gmail(dot)com> | 
| Cc: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> | 
| Subject: | Re: Sort operation displays more tuples than it contains its subnode | 
| Date: | 2024-05-23 14:16:14 | 
| Message-ID: | 55816aa0-a493-4ff3-a1c4-52948a809712@postgrespro.ru | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Yes, I got it. Thank you very much for the explanation.
On 23.05.2024 00:17, Tom Lane wrote:
> "a.rybakina" <a(dot)rybakina(at)postgrespro(dot)ru> writes:
>> I faced the issue, when the sorting node in the actual information
>> shows a larger number of tuples than it actually is. And I can not
>> understand why?
> If I'm reading this correctly, the sort node you're worrying about
> feeds the inner side of a merge join.  Merge join will rewind its
> inner side to the start of the current group of equal-keyed tuples
> whenever it sees that the next outer tuple must also be joined to
> that group.  Since what EXPLAIN is counting is the number of tuples
> returned from the node, that causes it to double-count those tuples.
> The more duplicate-keyed tuples on the outer side, the bigger the
> effect.
>
> You can see the same thing happening at the Materialize a little
> further up, which is feeding the inside of the other merge join.
-- 
Regards,
Alena Rybakina
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2024-05-23 15:10:49 | Re: about cross-compiling issue | 
| Previous Message | Robert Haas | 2024-05-23 13:49:19 | Re: State of pg_createsubscriber |