Re: Use BumpContext contexts for TupleHashTables' tablecxt
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org, Jeff Janes <jeff.janes@gmail.com>
Date: 2025-10-26T21:46:01Z
Lists: pgsql-hackers
On Mon, 27 Oct 2025 at 09:55, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > [ starting a new thread to keep this separate from the estimation > issue ] > > I looked at the callers of BuildTupleHashTable, and realized that > (a) every one of them can use a BumpContext for the "tablecxt", > and (b) Jeff Davis already noticed that for nodeAgg.c, in commit > cc721c459. So we have precedent for the idea working. Here's > a fleshed-out patch to fix the remaining callers. Yeah, this should give a decent performance improvement for larger workloads. I can't help wonder if we can improve the memory context parameter names in BuildTupleHashTable(). Every time I see "tablecxt" I have to remind myself that it's not for the bucket array, just the stuff we have the buckets point to. Would "hashedtuplecxt" be better? If we did that, then the context names could use some of the same treatment, "RecursiveUnion hashed tuples" and "SetOp hashed tuples" or something. The field name for TupleHashTableData.tablecxt and the comment (/* memory context containing table */) also leads me into thinking it's for the bucket array. Maybe I'm unique in having that problem... David
Commits
-
Use BumpContext contexts in TupleHashTables, and do some code cleanup.
- c106ef08071a 19 (unreleased) landed
-
HashAgg: use Bump allocator for hash TupleHashTable entries.
- cc721c459d37 18.0 cited