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 E1gsP63-0004hA-Pl@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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/317ffdfeaac12e434b2befa24993dc1b52a140fd

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: Tom Lane
Date:
Subject: pgsql: First-draft release notes for 11.2.
Next
From: Andres Freund
Date:
Subject: pgsql: Plug leak in BuildTupleHashTable by creating ExprContext incorr