pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Speedup Hash Joins with dedicated functions for ExprState hashin
Date: Tue, 10 Dec 2024 22:32:37 +0000
Message-ID: <E1tL8mS-0026L0-Cj@gemulon.postgresql.org> (raw)

Speedup Hash Joins with dedicated functions for ExprState hashing

Hashing of a single Var is a very common operation for ExprState to
perform.  Here we add dedicated ExecJust* functions which helps speed up
Hash Joins by removing the interpretation overhead in ExecInterpExpr().

This change currently only affects Hash Joins on a single column.  Hash
Joins with multiple join keys or an expression still run through
ExecInterpExpr().

Some testing has shown up to 10% query performance increases on recent AMD
hardware and nearly 7% increase on an Apple M2 for a query performing a
hash join with a large number of lookups on a small hash table.

This change was extracted from a larger patch which adjusts GROUP BY /
hashed subplans / hashed set operations to use ExprState hashing.

Discussion: https://postgr.es/m/CAApHDvr8Zc0ZgzVoCZLdHGOFNhiJeQ6vrUcS9V7N23zMWQb-eA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/50416cc4843a85fcb53507e21577cce16c75c65f

Modified Files
--------------
src/backend/executor/execExprInterp.c | 206 +++++++++++++++++++++++++++++++++-
1 file changed, 205 insertions(+), 1 deletion(-)



Message-ID: <E1tL8mS-0026L0-Cj@gemulon.postgresql.org>
Permalink:  ../E1tL8mS-0026L0-Cj@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tL8mS-0026L0-Cj@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Speedup Hash Joins with dedicated functions for ExprState hashin
  In-Reply-To: <E1tL8mS-0026L0-Cj@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox