pgsql: Specialize tuplesort routines for different kinds of abbreviated - Mailing list pgsql-committers

From John Naylor
Subject pgsql: Specialize tuplesort routines for different kinds of abbreviated
Date
Msg-id E1naZ8x-000QbH-D0@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Specialize tuplesort routines for different kinds of abbreviated  (John Naylor <john.naylor@enterprisedb.com>)
Re: pgsql: Specialize tuplesort routines for different kinds of abbreviated  (David Rowley <dgrowleyml@gmail.com>)
List 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(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Remove obsolete comment
Next
From: John Naylor
Date:
Subject: Re: pgsql: Specialize tuplesort routines for different kinds of abbreviated