postgresql/src/include
Melanie Plageman bfe56cdf9a Delay extraction of TIDBitmap per page offsets
Pages from the bitmap created by the TIDBitmap API can be exact or
lossy. The TIDBitmap API extracts the tuple offsets from exact pages
into an array for the convenience of the caller.

This was done in tbm_private|shared_iterate() right after advancing the
iterator. However, as long as tbm_private|shared_iterate() set a
reference to the PagetableEntry in the TBMIterateResult, the offset
extraction can be done later.

Waiting to extract the tuple offsets has a few benefits. For the shared
iterator case, it allows us to extract the offsets after dropping the
shared iterator state lock, reducing time spent holding a contended
lock.

Separating the iteration step and extracting the offsets later also
allows us to avoid extracting the offsets for prefetched blocks. Those
offsets were never used, so the overhead of extracting and storing them
was wasted.

The real motivation for this change, however, is that future commits
will make bitmap heap scan use the read stream API. This requires a
TBMIterateResult per issued block. By removing the array of tuple
offsets from the TBMIterateResult and only extracting the offsets when
they are used, we reduce the memory required for per buffer data
substantially.

Suggested-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKGLHbKP3jwJ6_%2BhnGi37Pw3BD5j2amjV3oSk7j-KyCnY7Q%40mail.gmail.com
2025-02-24 16:10:19 -05:00
..
access Delay extraction of TIDBitmap per page offsets 2025-02-24 16:10:19 -05:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup Update copyright for 2025 2025-01-01 11:21:55 -05:00
bootstrap Update copyright for 2025 2025-01-01 11:21:55 -05:00
catalog Remove read/sync fields from pg_stat_wal and GUC track_wal_io_timing 2025-02-24 09:51:56 +09:00
commands Don't lock partitions pruned by initial pruning 2025-02-20 17:09:48 +09:00
common Silence warning in older versions of Valgrind 2025-02-24 18:03:29 +07:00
datatype Avoid using timezone Asia/Manila in regression tests. 2025-01-20 15:47:53 -05:00
executor Don't lock partitions pruned by initial pruning 2025-02-20 17:09:48 +09:00
fe_utils Specify the encoding of input to fmtId() 2025-02-10 10:03:37 -05:00
foreign Update copyright for 2025 2025-01-01 11:21:55 -05:00
jit Fix grammatical typos around possessive "its" 2025-01-29 14:39:14 +07:00
lib Add new StringInfo APIs to allow callers to specify the buffer size. 2025-01-11 08:23:46 +09:00
libpq backend libpq void * argument for binary data 2025-02-23 14:27:02 +01:00
mb Add pg_encoding_set_invalid() 2025-02-10 10:03:37 -05:00
nodes Delay extraction of TIDBitmap per page offsets 2025-02-24 16:10:19 -05:00
optimizer Implement Self-Join Elimination 2025-02-17 12:44:12 +02:00
parser Virtual generated columns 2025-02-07 09:46:59 +01:00
partitioning Move PartitionPruneInfo out of plan nodes into PlannedStmt 2025-01-30 11:57:32 +09:00
pch Update copyright for 2025 2025-01-01 11:21:55 -05:00
port Fix comment about AVX-512 popcount support. 2025-01-22 14:11:37 -06:00
portability Update copyright for 2025 2025-01-01 11:21:55 -05:00
postmaster Move MAX_BACKENDS to procnumber.h 2025-02-24 06:23:41 -05:00
regex Update copyright for 2025 2025-01-01 11:21:55 -05:00
replication backend launchers void * arguments for binary data 2025-02-21 08:03:33 +01:00
rewrite Implement Self-Join Elimination 2025-02-17 12:44:12 +02:00
snowball Update to latest Snowball sources. 2025-02-18 21:13:54 -05:00
statistics Update copyright for 2025 2025-01-01 11:21:55 -05:00
storage Fix comment for MAX_BACKENDS. 2025-02-24 15:02:09 -06:00
tcop backend launchers void * arguments for binary data 2025-02-21 08:03:33 +01:00
tsearch Update copyright for 2025 2025-01-01 11:21:55 -05:00
utils Don't lock partitions pruned by initial pruning 2025-02-20 17:09:48 +09:00
.gitignore Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
c.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
fmgr.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
funcapi.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
getopt_long.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
Makefile Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
miscadmin.h Use "ssize_t" not "long" in max_stack_depth-related code. 2025-01-30 16:44:47 -05:00
pg_config.h.in Add support for OAUTHBEARER SASL mechanism 2025-02-20 16:25:17 +01:00
pg_config_manual.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_getopt.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
pg_trace.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
pgstat.h Remove read/sync fields from pg_stat_wal and GUC track_wal_io_timing 2025-02-24 09:51:56 +09:00
pgtar.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pgtime.h Seek zone abbreviations in the IANA data before timezone_abbreviations. 2025-01-16 14:11:19 -05:00
port.h Avoid breaking SJIS encoding while de-backslashing Windows paths. 2025-01-29 14:24:36 -05:00
postgres.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
postgres_ext.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
postgres_fe.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
varatt.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
windowapi.h Update copyright for 2025 2025-01-01 11:21:55 -05:00