mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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.
This commit is contained in:
@ -1928,6 +1928,16 @@ static struct config_int ConfigureNamesInt[] =
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"replacement_sort_tuples", PGC_USERSET, RESOURCES_MEM,
|
||||
gettext_noop("Sets the maximum number of tuples to be sorted using replacement selection."),
|
||||
gettext_noop("When more tuples than this are present, quicksort will be used.")
|
||||
},
|
||||
&replacement_sort_tuples,
|
||||
150000, 0, INT_MAX,
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
/*
|
||||
* We use the hopefully-safely-small value of 100kB as the compiled-in
|
||||
* default for max_stack_depth. InitializeGUCOptions will increase it if
|
||||
|
Reference in New Issue
Block a user