pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Use quicksort, not replacement selection, for external sorting.
4+ messages / 3 participants
[nested] [flat]

* pgsql: Use quicksort, not replacement selection, for external sorting.
@ 2016-04-08 06:39 Robert Haas <rhaas@postgresql.org>
  2016-04-08 14:40 ` Re: pgsql: Use quicksort, not replacement selection, for external sorting. Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Robert Haas @ 2016-04-08 06:39 UTC (permalink / raw)
  To: 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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


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

* Re: pgsql: Use quicksort, not replacement selection, for external sorting.
  2016-04-08 06:39 pgsql: Use quicksort, not replacement selection, for external sorting. Robert Haas <rhaas@postgresql.org>
@ 2016-04-08 14:40 ` Tom Lane <tgl@sss.pgh.pa.us>
  2016-04-08 14:47   ` Re: pgsql: Use quicksort, not replacement selection, for external sorting. Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2016-04-08 14:40 UTC (permalink / raw)
  To: Robert Haas <rhaas@postgresql.org>; Peter Geoghegan <pg@heroku.com>; +Cc: pgsql-committers

Robert Haas <rhaas@postgresql.org> writes:
> Use quicksort, not replacement selection, for external sorting.

This patch evidently broke several of the Windows buildfarm critters,
eg on mastodon:

Build FAILED.
.\src\backend\utils\sort\tuplesort.c(2373): error C2143: syntax error : missing ';' before 'type'
.\src\backend\utils\sort\tuplesort.c(2377): error C2065: 'ntuples' : undeclared identifier
    0 Warning(s)
    2 Error(s)



			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



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

* Re: pgsql: Use quicksort, not replacement selection, for external sorting.
  2016-04-08 06:39 pgsql: Use quicksort, not replacement selection, for external sorting. Robert Haas <rhaas@postgresql.org>
  2016-04-08 14:40 ` Re: pgsql: Use quicksort, not replacement selection, for external sorting. Tom Lane <tgl@sss.pgh.pa.us>
@ 2016-04-08 14:47   ` Tom Lane <tgl@sss.pgh.pa.us>
  2016-04-08 14:53     ` Re: pgsql: Use quicksort, not replacement selection, for external sorting. Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2016-04-08 14:47 UTC (permalink / raw)
  To: Robert Haas <rhaas@postgresql.org>; Peter Geoghegan <pg@heroku.com>; +Cc: pgsql-committers

I wrote:
> Robert Haas <rhaas@postgresql.org> writes:
>> Use quicksort, not replacement selection, for external sorting.

> This patch evidently broke several of the Windows buildfarm critters,

On inspection, the problem is obviously "declaration in the middle of
a code block".

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



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

* Re: pgsql: Use quicksort, not replacement selection, for external sorting.
  2016-04-08 06:39 pgsql: Use quicksort, not replacement selection, for external sorting. Robert Haas <rhaas@postgresql.org>
  2016-04-08 14:40 ` Re: pgsql: Use quicksort, not replacement selection, for external sorting. Tom Lane <tgl@sss.pgh.pa.us>
  2016-04-08 14:47   ` Re: pgsql: Use quicksort, not replacement selection, for external sorting. Tom Lane <tgl@sss.pgh.pa.us>
@ 2016-04-08 14:53     ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Robert Haas @ 2016-04-08 14:53 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Geoghegan <pg@heroku.com>; pgsql-committers

On Fri, Apr 8, 2016 at 10:47 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
>> Robert Haas <rhaas@postgresql.org> writes:
>>> Use quicksort, not replacement selection, for external sorting.
>
>> This patch evidently broke several of the Windows buildfarm critters,
>
> On inspection, the problem is obviously "declaration in the middle of
> a code block".

Woops.  Attempted a fix.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



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


end of thread, other threads:[~2016-04-08 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-04-08 06:39 pgsql: Use quicksort, not replacement selection, for external sorting. Robert Haas <rhaas@postgresql.org>
2016-04-08 14:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-04-08 14:47   ` Tom Lane <tgl@sss.pgh.pa.us>
2016-04-08 14:53     ` Robert Haas <robertmhaas@gmail.com>

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