postgresql/src/include
David Rowley d8a859d22b Reduce size of CompactAttribute struct to 8 bytes
Previously, this was 16 bytes.  With the use of some bitflags and by
reducing the attcacheoff field size to a 16-bit type, we can halve the
size of the struct.

It's unlikely that caching the offsets for offsets larger than what will
fit in a 16-bit int will help much as the tuple is very likely to have
some non-fixed-width types anyway, the offsets of which we cannot cache.

Shrinking this down to 8 bytes helps by accessing fewer cachelines when
performing tuple deformation.  The fields used there are all fully
fledged fields, which don't require any bitmasking to extract the value
of.  It also helps to more efficiently calculate the address of a
compact_attrs[] element in TupleDesc as the x86 LEA instruction can work
with 8 byte offsets, which allows the element address to be calculated
from the TupleDesc's address in a single instruction using LEA's
concurrent shift and add.

Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAApHDvodSVBj3ypOYbYUCJX%2BNWL%3DVZs63RNBQ_FxB_F%2B6QXF-A%40mail.gmail.com
2026-03-17 15:06:31 +13:00
..
access Reduce size of CompactAttribute struct to 8 bytes 2026-03-17 15:06:31 +13:00
archive Update copyright for 2026 2026-01-01 13:24:10 -05:00
backup Update copyright for 2026 2026-01-01 13:24:10 -05:00
bootstrap Reduce header inclusions via execnodes.h 2026-03-16 14:34:57 +01:00
catalog Reduce header inclusions via execnodes.h 2026-03-16 14:34:57 +01:00
commands Reduce header inclusions via execnodes.h 2026-03-16 14:34:57 +01:00
common Use fallthrough attribute instead of comment 2026-02-19 08:51:12 +01:00
datatype Update copyright for 2026 2026-01-01 13:24:10 -05:00
executor Reduce header inclusions via execnodes.h 2026-03-16 14:34:57 +01:00
fe_utils pg_dumpall: Fix handling of conflicting options. 2026-03-06 14:00:04 -06:00
foreign CREATE SUBSCRIPTION ... SERVER. 2026-03-06 08:27:56 -08:00
jit Fix typos and inconsistencies in code and comments 2026-01-05 09:19:15 +09:00
lib Reduce header inclusions via execnodes.h 2026-03-16 14:34:57 +01:00
libpq Don't include proc.h in shm_mq.h 2026-02-27 10:53:47 +01:00
mb Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:44:04 +13:00
nodes Reduce header inclusions via execnodes.h 2026-03-16 14:34:57 +01:00
optimizer Convert NOT IN sublinks to anti-joins when safe 2026-03-12 09:45:18 +09:00
parser SQL Property Graph Queries (SQL/PGQ) 2026-03-16 10:14:18 +01:00
partitioning Update copyright for 2026 2026-01-01 13:24:10 -05:00
pch Update copyright for 2026 2026-01-01 13:24:10 -05:00
port Fix some -Wcast-qual warnings 2026-02-27 21:57:33 +01:00
portability instrumentation: Drop INSTR_TIME_SET_CURRENT_LAZY macro 2026-02-26 10:39:29 -05:00
postmaster Fix some -Wcast-qual warnings 2026-02-27 21:57:33 +01:00
regex Update copyright for 2026 2026-01-01 13:24:10 -05:00
replication Avoid including utils/timestamp.h in conflict.h. 2026-02-23 10:19:05 +05:30
rewrite SQL Property Graph Queries (SQL/PGQ) 2026-03-16 10:14:18 +01:00
snowball Update to latest Snowball sources. 2026-01-05 15:22:37 -05:00
statistics Add support for "mcv" in pg_restore_extended_stats() 2026-01-29 12:14:08 +09:00
storage Use C11 alignas in typedef definitions 2026-03-16 11:35:51 +01:00
tcop SQL Property Graph Queries (SQL/PGQ) 2026-03-16 10:14:18 +01:00
tsearch Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:44:04 +13:00
utils SQL Property Graph Queries (SQL/PGQ) 2026-03-16 10:14:18 +01:00
.gitignore Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
c.h Hardcode override of typeof_unqual for clang-for-bitcode 2026-03-16 19:24:49 +01:00
fmgr.h Improve type handling of varlena structures 2026-02-11 07:33:24 +09:00
funcapi.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
getopt_long.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
Makefile Fix build inconsistency due to the generation of wait-event code 2026-02-02 08:02:39 +09:00
meson.build Ensure that all three build methods install the same set of files. 2026-02-16 15:20:15 -05:00
miscadmin.h Add password expiration warnings. 2026-02-11 10:36:15 -06:00
pg_config.h.in Change copyObject() to use typeof_unqual 2026-03-13 07:06:57 +01:00
pg_config_manual.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_getopt.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_trace.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pgstat.h Don't include wait_event.h in pgstat.h 2026-03-06 16:24:58 +01:00
pgtar.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pgtime.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
port.h strnlen() is now required 2026-01-08 08:51:20 +01:00
postgres.h Remove Int8GetDatum function 2026-03-11 10:46:08 +01:00
postgres_ext.h Move pg_int64 back to postgres_ext.h 2025-09-16 10:48:56 +02:00
postgres_fe.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
varatt.h Improve type handling of varlena structures 2026-02-11 07:33:24 +09:00
windowapi.h Update copyright for 2026 2026-01-01 13:24:10 -05:00