pgsql: Specialize tuplesort routines for different kinds of abbreviated

From: John Naylor <john(dot)naylor(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Specialize tuplesort routines for different kinds of abbreviated
Date: 2022-04-02 08:29:59
Message-ID: E1naZ8x-000QbH-D0@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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%40mail.gmail.com

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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message John Naylor 2022-04-02 09:06:40 Re: pgsql: Specialize tuplesort routines for different kinds of abbreviated
Previous Message Peter Eisentraut 2022-04-02 05:43:10 pgsql: Remove obsolete comment