pgsql: Use quicksort, not replacement selection, for external sorting.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use quicksort, not replacement selection, for external sorting.
Date: 2016-04-08 06:39:48
Message-ID: E1aoQ56-0001hD-SR@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use quicksort, not replacement selection, for external sorting.

We still use replacement selection for the first run of the sort only
and only when the number of tuples is relatively small. Otherwise,
the first run, and subsequent runs in all cases, are produced using
quicksort. This tends to be faster except perhaps for very small
amounts of working memory.

Peter Geoghegan, reviewed by Tomas Vondra, Jeff Janes, Mithun Cy,
Greg Stark, and me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/0711803775a37e0bf39d7efdd1e34d9d7e640ea1

Modified Files
--------------
doc/src/sgml/config.sgml | 39 +++
src/backend/optimizer/path/costsize.c | 6 +-
src/backend/utils/init/globals.c | 1 +
src/backend/utils/misc/guc.c | 10 +
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/backend/utils/sort/tuplesort.c | 463 +++++++++++++++++++++-----
src/include/miscadmin.h | 1 +
7 files changed, 430 insertions(+), 91 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2016-04-08 07:49:30 pgsql: Add regression tests for multiple synchronous standbys.
Previous Message Robert Haas 2016-04-08 06:08:00 pgsql: Extend relations multiple blocks at a time to improve scalabilit