pgsql: Speed up text sorts where the same strings occur multiple times.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Speed up text sorts where the same strings occur multiple times.
Date: 2015-10-09 23:39:37
Message-ID: E1ZkhGD-0001WK-HP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Speed up text sorts where the same strings occur multiple times.

Cache strxfrm() blobs across calls made to the text SortSupport
abbreviation routine. This can speed up sorting if the same string
needs to be abbreviated many times in a row.

Also, cache the result of the previous strcoll() comparison, so that
if we're asked to compare the same strings agin, we do need to call
strcoll() again.

Perhaps surprisingly, these optimizations don't seem to hurt even when
they don't help. memcmp() is really cheap compared to strcoll() or
strxfrm().

Peter Geoghegan, reviewed by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/0e57b4d8bd9674adaf5747421b3255b85e385534

Modified Files
--------------
src/backend/utils/adt/varlena.c | 75 ++++++++++++++++++++++++++++++++++++---
1 file changed, 71 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2015-10-12 00:45:27 pgsql: Avoid scan-build warning about uninitialized htonl() arguments.
Previous Message Tom Lane 2015-10-09 21:42:34 Re: pgsql: Perform an immediate shutdown if the postmaster.pid file is remo