pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Simplify loop logic in nodeIncrementalSort.c.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Simplify loop logic in nodeIncrementalSort.c.
@ 2021-02-15 15:18 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-02-15 15:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Simplify loop logic in nodeIncrementalSort.c.
@ 2021-02-15 15:18 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-02-15 15:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/80dc07aa361b9b0028e49bbdf7a947775211b812

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-02-15 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 15:18 pgsql: Simplify loop logic in nodeIncrementalSort.c. Tom Lane <tgl@sss.pgh.pa.us>
2021-02-15 15:18 pgsql: Simplify loop logic in nodeIncrementalSort.c. Tom Lane <tgl@sss.pgh.pa.us>

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