pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Simplify loop logic in nodeIncrementalSort.c.
Date: Mon, 15 Feb 2021 15:18:13 +0000
Message-ID: <E1lBfdd-0002wQ-Vy@gemulon.postgresql.org> (raw)

Simplify loop logic in nodeIncrementalSort.c.

The inner loop in switchToPresortedPrefixMode() can be implemented
as a conventional integer-counter for() loop, removing a couple of
redundant boolean state variables.  The old logic here was a remnant
of earlier development, but as things now stand there's no reason
for extra complexity.

Also, annotate the test case added by 82e0e2930 to explain why it
manages to hit the corner case fixed in that commit, and add an
EXPLAIN to verify that it's creating an incremental-sort plan.

Back-patch to v13, like the previous patch.

James Coleman and Tom Lane

Discussion: https://postgr.es/m/16846-ae49f51ac379a4cb@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0e5290312851557ee24e3d6103baf14d6066695c

Modified Files
--------------
src/backend/executor/nodeIncrementalSort.c     | 45 +++++++-------------------
src/test/regress/expected/incremental_sort.out | 15 +++++++++
src/test/regress/sql/incremental_sort.sql      |  4 +++
3 files changed, 30 insertions(+), 34 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1lBfdd-0002wQ-Vy@gemulon.postgresql.org>
Permalink:  ../E1lBfdd-0002wQ-Vy@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lBfdd-0002wQ-Vy@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Simplify loop logic in nodeIncrementalSort.c.
  In-Reply-To: <E1lBfdd-0002wQ-Vy@gemulon.postgresql.org>
  References: <E1lBfdd-0002wQ-Vy@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox