Re: Add ExprState hashing for GROUP BY and hashed SubPlans

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Andrei Lepikhov <lepihov@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2024-10-31T23:17:27Z
Lists: pgsql-hackers

Attachments

On Thu, 31 Oct 2024 at 15:30, Andrei Lepikhov <lepihov@gmail.com> wrote:
> Comparing the master with and without your patch, the first, I see is
> more extensive usage of memory (see complete explains in the attachment):
>
> Current master:
>    Batches: 1  Memory Usage: 74513kB

> Patched:
>    Batches: 261  Memory Usage: 527905kB  Disk Usage: 4832656kB

Thanks for testing that. I had forgotten to adjust the storage
location for the hash initial value when I rebased the patch against
the changes made in 9ca67658d. I've fixed that in the attached patch.

The patched version comes out faster for me now:

master: Execution Time: 15515.401 ms
v4 patch: Execution Time: 15024.395 ms

David

Commits

  1. Use ExprStates for hashing in GROUP BY and SubPlans

  2. Speedup Hash Joins with dedicated functions for ExprState hashing

  3. Remove unused field from SubPlanState struct