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-11-05T20:38:09Z
Lists: pgsql-hackers
Attachments
- v5-0001-Use-ExprStates-for-hashing-in-GROUP-BY-and-SubPla.patch (text/plain) patch v5-0001
- v5-0002-Support-murmur32-hashing-of-the-final-ExprState-h.patch.txt (text/plain)
On Sat, 2 Nov 2024 at 22:13, Andrei Lepikhov <lepihov@gmail.com> wrote: > Okay, I passed through the code. It looks good. Hashing expressions are > too simple to give notably impressive results, but it is a step in the > right direction. > I found only one minor issue: an outdated comment (see attachment). Thanks for looking. I ended up doing a bit more work on that comment. See attached. I was performing some final benchmarks on this and found that there's a small performance regression for hashed subplans. The test case is: create table t1 (a int); insert into t1 select a from generate_series(1,100000)a; select * from t1 where a not in(select a from t1); With my Zen4 laptop I get: gcc: master tps = 58.0375255 v5-0001 tps = 56.11840762 clang: master tps = 58.72993378 v5-0001 tps = 53.39965968 Zen2 3990x gcc: master tps = 34.30392818 v5-0001 tps = 33.22067202 clang: master tps = 34.0497471 v5-0001 tps = 33.34801254 That's the average over 50 runs starting and stopping the server on each 10 second run. I'm still thinking about what to do about this. In the meantime, I'm not going to commit it. > Also, to make a hash calculation as fast as possible, should we add the > call of murmurhash32 as an optional step of ExprState in the > ExecBuildHash32FromAttrs? I wrote enough of this patch to test the performance. It does not help. See attached 0002. David
Commits
-
Use ExprStates for hashing in GROUP BY and SubPlans
- 0f5738202b81 18.0 landed
-
Speedup Hash Joins with dedicated functions for ExprState hashing
- 50416cc4843a 18.0 landed
-
Remove unused field from SubPlanState struct
- 3974bc319639 18.0 landed