pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Naylor <john.naylor@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Specialize tuplesort routines for different kinds of abbreviated
Date: Sat, 02 Apr 2022 08:29:59 +0000
Message-ID: <E1naZ8x-000QbH-D0@gemulon.postgresql.org> (raw)

Specialize tuplesort routines for different kinds of abbreviated keys

Previously, the specialized tuplesort routine inlined handling for
reverse-sort and NULLs-ordering but called the datum comparator via a
pointer in the SortSupport struct parameter. Testing has showed that we
can get a useful performance gain by specializing datum comparison for
the different representations of abbreviated keys -- signed and unsigned
64-bit integers and signed 32-bit integers. Almost all abbreviatable data
types will benefit -- the only exception for now is numeric, since the
datum comparison is more complex. The performance gain depends on data
type and input distribution, but often falls in the range of 10-20% faster.

Thomas Munro

Reviewed by Peter Geoghegan, review and performance testing by me

Discussion:
https://www.postgresql.org/message-id/CA%2BhUKGKKYttZZk-JMRQSVak%3DCXSJ5fiwtirFf%3Dn%3DPAbumvn1Ww%40...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6974924347c908335607a4a2f252213d58e21b7c

Modified Files
--------------
src/backend/access/gist/gistproc.c     |  18 +---
src/backend/access/nbtree/nbtcompare.c |  22 ++---
src/backend/utils/adt/date.c           |  15 +---
src/backend/utils/adt/mac.c            |  23 +----
src/backend/utils/adt/network.c        |  17 +---
src/backend/utils/adt/timestamp.c      |  11 +++
src/backend/utils/adt/uuid.c           |  25 ++----
src/backend/utils/adt/varlena.c        |  34 ++-----
src/backend/utils/sort/tuplesort.c     | 160 ++++++++++++++++++++++++++++++++-
src/include/utils/sortsupport.h        | 115 ++++++++++++++++++++++++
10 files changed, 308 insertions(+), 132 deletions(-)



view thread (13+ messages)  latest in thread

Message-ID: <E1naZ8x-000QbH-D0@gemulon.postgresql.org>
Permalink:  ../E1naZ8x-000QbH-D0@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1naZ8x-000QbH-D0@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: john.naylor@postgresql.org
  Subject: Re: pgsql: Specialize tuplesort routines for different kinds of abbreviated
  In-Reply-To: <E1naZ8x-000QbH-D0@gemulon.postgresql.org>
  References: <E1naZ8x-000QbH-D0@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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