Re: Plan weirdness. A sort produces more rows than the node beneath it - Mailing list pgsql-performance

From Tom Lane
Subject Re: Plan weirdness. A sort produces more rows than the node beneath it
Date
Msg-id 3658472.1691161821@sss.pgh.pa.us
Whole thread Raw
In response to Plan weirdness. A sort produces more rows than the node beneath it  (Dane Foster <studdugie@gmail.com>)
Responses Re: Plan weirdness. A sort produces more rows than the node beneath it  (Dane Foster <studdugie@gmail.com>)
List pgsql-performance
Dane Foster <studdugie@gmail.com> writes:
> 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?

If the sort is the inner input to a merge join, this could reflect
mark-and-restore rescanning of the sort's output.  Are there a
whole lot of duplicate keys on the merge's other side?

            regards, tom lane



pgsql-performance by date:

Previous
From: Dane Foster
Date:
Subject: Re: Plan weirdness. A sort produces more rows than the node beneath it
Next
From: Dane Foster
Date:
Subject: Re: Plan weirdness. A sort produces more rows than the node beneath it