On Thu, 2025-01-02 at 13:38 +1300, David Rowley wrote: > On Thu, 2 Jan 2025 at 13:33, Tom Lane <t...@sss.pgh.pa.us> wrote: > > > > David Rowley <dgrowle...@gmail.com> writes: > > > I think what would be more interesting is seeing if we can store > > > the > > > TupleHashEntryData.firstTuple in a bump context. > > > > Are you saying the same as above, or something different? > > I thought you only meant store the hash buckets in a bump context. I > didn't realise you meant the tuples too. Seems we were talking about > the same thing.
There are several things to keep track of: 1. The bucket array, which is already in its own context (called the metacxt). AllocSet is probably fine here. I agree that there is some room for improvement, but remember that if the bucket array gets to any interesting size, it will be allocated in its own block. 2. The grouping keys (called firstTuple), which are in the tablecxt. These could benefit from the Bump allocator. 3. The pergroup states, which are also stored in the tablecxt, and these can also benefit from the Bump allocator. 4. If the transition type is by-ref, the transition value. If we separate out 4, we can use the Bump allocator for 2 & 3. Regards, Jeff Davis