Re: Incorrect CHUNKHDRSZ in nodeAgg.c

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: David Rowley <dgrowleyml@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2025-01-08T20:50:10Z
Lists: pgsql-hackers

Attachments

On Mon, 2025-01-06 at 12:34 -0800, Jeff Davis wrote:
> If we separate out 4, we can use the Bump allocator for 2 & 3.

Attached POC patch, which reduces memory usage by ~15% for a simple
distinct query on an integer key. Performance is the same or perhaps a
hair faster.

It's not many lines of code, but the surrounding code might benefit
from some refactoring which would make it a bit simpler.

Regards,
	Jeff Davis

Commits

  1. HashAgg: use Bump allocator for hash TupleHashTable entries.

  2. Fix outdated CHUNKHDRSZ value in nodeAgg.c