Re: BUG #16846: "retrieved too many tuples in a bounded sort"

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: James Coleman <jtc331@gmail.com>
Cc: Neil Chen <carpenter.nail.cz@gmail.com>, contact@yorhel.nl, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2021-02-15T15:18:46Z
Lists: pgsql-bugs
James Coleman <jtc331@gmail.com> writes:
> On Thu, Feb 11, 2021 at 12:06 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I stared at this for awhile and eventually convinced myself that it
>> implemented the same logic, but it still seems overly complex.  We
>> do not need either the firstTuple or lastTuple flags, and we could
>> convert the nTuple adjustments into a normal for-loop with (IMO)
>> much greater intelligibility.  What do you think of the attached?

> Yes, that looks even better. Not sure how I missed that I'd just
> reimplemented a normal for-loop with firstTuple/lastTuple conditions,
> but I guess that's the benefit of coming at it with fresh eyes and
> without the history of how it got the way it was.

> +1 on committing v2.

Sounds good, pushed.

			regards, tom lane



Commits

  1. Simplify loop logic in nodeIncrementalSort.c.

  2. Fix YA incremental sort bug.