pgsql: Make nodeSort.c use Datum sorts for single column sorts

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make nodeSort.c use Datum sorts for single column sorts
Date: 2021-07-22 02:03:38
Message-ID: E1m6O3m-0007XT-O6@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make nodeSort.c use Datum sorts for single column sorts

Datum sorts can be significantly faster than tuple sorts, especially when
the data type being sorted is a pass-by-value type. Something in the
region of 50-70% performance improvements appear to be possible.

Just in case there's any confusion; the Datum sort is only used when the
targetlist of the Sort node contains a single column, not when there's a
single column in the sort key and multiple items in the target list.

Author: Ronan Dunklau
Reviewed-by: James Coleman, David Rowley, Ranier Vilela, Hou Zhijie
Tested-by: John Naylor
Discussion: https://postgr.es/m/3177670.itZtoPt7T5@aivenronan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/91e9e89dccdfdf4216953d3d8f5515dcdef177fb

Modified Files
--------------
src/backend/executor/nodeSort.c | 106 ++++++++++++++++++++++++++++++----------
src/include/nodes/execnodes.h | 1 +
2 files changed, 82 insertions(+), 25 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2021-07-22 03:24:22 pgsql: jit: Don't inline functions that access thread-locals.
Previous Message Andrew Dunstan 2021-07-22 01:08:28 Re: pgsql: Re-enable TAP tests of pg_receivewal for ZLIB on Windows