postgresql/src/include
David Rowley adf97c1562 Speed up Hash Join by making ExprStates support hashing
Here we add ExprState support for obtaining a 32-bit hash value from a
list of expressions.  This allows both faster hashing and also JIT
compilation of these expressions.  This is especially useful when hash
joins have multiple join keys as the previous code called ExecEvalExpr on
each hash join key individually and that was inefficient as tuple
deformation would have only taken into account one key at a time, which
could lead to walking the tuple once for each join key.  With the new
code, we'll determine the maximum attribute required and deform the tuple
to that point only once.

Some performance tests done with this change have shown up to a 20%
performance increase of a query containing a Hash Join without JIT
compilation and up to a 26% performance increase when JIT is enabled and
optimization and inlining were performed by the JIT compiler.  The
performance increase with 1 join column was less with a 14% increase
with and without JIT.  This test was done using a fairly small hash
table and a large number of hash probes.  The increase will likely be
less with large tables, especially ones larger than L3 cache as memory
pressure is more likely to be the limiting factor there.

This commit only addresses Hash Joins, but lays expression evaluation
and JIT compilation infrastructure for other hashing needs such as Hash
Aggregate.

Author: David Rowley
Reviewed-by: Alexey Dvoichenkov <alexey@hyperplane.net>
Reviewed-by: Tels <nospam-pg-abuse@bloodgate.com>
Discussion: https://postgr.es/m/CAApHDvoexAxgQFNQD_GRkr2O_eJUD1-wUGm%3Dm0L%2BGc%3DT%3DkEa4g%40mail.gmail.com
2024-08-20 13:38:22 +12:00
..
access Give nbtree move right function internal linkage. 2024-08-12 14:36:55 -04:00
archive Add macro for customizing an archiving WARNING message. 2024-03-04 15:41:42 -06:00
backup Align blocks in incremental backups to BLCKSZ 2024-04-05 16:30:01 +02:00
bootstrap Update copyright for 2024 2024-01-03 20:49:05 -05:00
catalog Improve ALTER PUBLICATION validation and error messages 2024-08-15 13:10:25 +12:00
commands Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
common Remove dependence on -fwrapv semantics in a few places. 2024-08-15 15:47:31 -05:00
datatype Update copyright for 2024 2024-01-03 20:49:05 -05:00
executor Speed up Hash Join by making ExprStates support hashing 2024-08-20 13:38:22 +12:00
fe_utils Improve file header comments for astramer code. 2024-08-07 08:49:41 -04:00
foreign Clean up more indent breakage from 6377e12a5. 2024-04-16 13:00:40 -04:00
jit Move resowner from common JitContext to LLVM specific 2024-07-19 10:27:06 +03:00
lib Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
libpq Use PqMsg_* macros in more places. 2024-07-17 10:51:00 -05:00
mb Inline basic UTF-8 functions. 2024-03-20 09:40:57 -07:00
nodes Speed up Hash Join by making ExprStates support hashing 2024-08-20 13:38:22 +12:00
optimizer Fix partitionwise join with partially-redundant join clauses 2024-07-30 15:51:54 +09:00
parser Remove obsolete RECHECK keyword completely 2024-08-09 07:18:51 +02:00
partitioning Implement ALTER TABLE ... SPLIT PARTITION ... command 2024-04-07 01:18:44 +03:00
pch Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Require memory barrier support. 2024-07-30 23:01:55 +12:00
portability Fix datatypes in comments in instr_time.h 2024-08-06 22:15:55 +03:00
postmaster Apply PGDLLIMPORT markings to some GUC variables 2024-08-14 11:36:12 +02:00
regex Cope with <regex.h> name clashes. 2024-07-06 10:27:16 +12:00
replication Allow altering of two_phase option of a SUBSCRIPTION. 2024-07-24 10:13:36 +05:30
rewrite Support MERGE into updatable views. 2024-02-29 15:56:59 +00:00
snowball Update copyright for 2024 2024-01-03 20:49:05 -05:00
statistics Update copyright for 2024 2024-01-03 20:49:05 -05:00
storage Apply PGDLLIMPORT markings to some GUC variables 2024-08-14 11:36:12 +02:00
tcop Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:33 -07:00
tsearch Constify fields and parameters in spell.c 2024-08-06 23:04:51 +03:00
utils Apply PGDLLIMPORT markings to some GUC variables 2024-08-14 11:36:12 +02:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Add macro to disable address safety instrumentation 2024-04-06 12:20:40 +07:00
fmgr.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
funcapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
getopt_long.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
Makefile Put genbki.pl output into src/include/catalog/ directly 2024-03-14 07:11:21 +01:00
meson.build meson: Restore implicit warning/debug/optimize flags for extensions 2024-06-07 09:36:26 +02:00
miscadmin.h Use pgBufferUsage for buffer usage tracking in analyze. 2024-08-13 18:49:45 -07:00
pg_config.h.in All POSIX systems have langinfo.h and CODESET. 2024-08-13 22:13:52 +12:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.meson meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_config_manual.h Remove TRACE_SORT macro 2024-08-14 08:07:52 +02:00
pg_getopt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_trace.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgstat.h Introduce pluggable APIs for Cumulative Statistics 2024-08-04 19:41:24 +09:00
pgtar.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgtime.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
port.h Add port/ replacement for strsep() 2024-07-22 09:50:30 +02:00
postgres.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
postgres_ext.h Move RelFileNumber declarations to common/relpath.h. 2022-09-27 12:01:57 -04:00
postgres_fe.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
varatt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
windowapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00