pgsql: Allow to reset execGrouping.c style tuple hashtables. - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: Allow to reset execGrouping.c style tuple hashtables.
Date
Msg-id E1gsP68-0004hu-N6@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Allow to reset execGrouping.c style tuple hashtables.

This has the advantage that the comparator expression, the table's
slot, etc do not have to be rebuilt. Additionally the simplehash.h
hashtable within the tuple hashtable now keeps its previous size and
doesn't need to be reallocated. That both reduces allocator overhead,
and improves performance in cases where the input estimation was off
by a significant factor.

To avoid an API/ABI break, the new parameter is exposed via the new
BuildTupleHashTableExt(), and BuildTupleHashTable() now is a wrapper
around the former, that continues to allocate the table itself in the
tablecxt.

Using this fixes performance issues discovered in the two bugs
referenced. This commit however has not converted the callers, that's
done in a separate commit.

Bug: #15592 #15486
Reported-By: Jakub Janeček, Dmitry Marakasov
Author: Andres Freund
Discussion:
    https://postgr.es/m/15486-05850f065da42931@postgresql.org
    https://postgr.es/m/20190114180423.ywhdg2iagzvh43we@alap3.anarazel.de
Backpatch: 11, this is a prerequisite for other fixes

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6455c65882474a48b6bde298bd04c18aa4e4b27f

Modified Files
--------------
src/backend/executor/execGrouping.c | 70 +++++++++++++++++++++++++++++--------
src/include/executor/executor.h     | 10 ++++++
2 files changed, 66 insertions(+), 14 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: simplehash: Add support for resetting a hashtable's contents.
Next
From: Andres Freund
Date:
Subject: pgsql: For 11 only,put back heap_expand_tuple to GetTupleForTrigger().