Re: Tepid: selective index updates for heap relations

Greg Burd <greg@burd.me>

From: "Greg Burd" <greg@burd.me>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-07-02T16:40:51Z
Lists: pgsql-hackers

Attachments

Rebased onto 51cd5d6f052.

The only interesting changes were in patch 0008:

- origin/master gained a new feature between v49 and v50 ("Allow logical replication conflicts to be logged to a table"), which touches the exact same subscription-option plumbing ours does. The rebase conflicted in 6 files; I resolved by making both features coexist:

- alter_subscription.sgml / create_subscription.sgml: the "alterable options" doc list now enumerates conflict_log_destination alongside hot_indexed_on_apply instead of standing alone.

- pg_subscription.c: GetSubscription() now also copies subconflictlogrelid (their field) next to our subhotindexedonapply copy — independent lines, both needed.

- system_views.sql: the pg_subscription GRANT SELECT column list now includes their subconflictlogrelid/subconflictlogdest in catalog-struct order alongside our column.

- subscriptioncmds.c — the one genuine bug fix: both features had independently claimed bit 0x00080000 for their SUBOPT_* flag. Real collision. Resolved by moving ours, SUBOPT_HOT_INDEXED_ON_APPLY, to 0x00100000; kept their SUBOPT_CONFLICT_LOG_DEST at 0x00080000. Also merged the else if option-parsing chain, the CREATE/ALTER SUBSCRIPTION supported-opts bitmasks, and the tuple-update logic so both options parse and apply independently (verified live: CREATE SUBSCRIPTION ... WITH (hot_indexed_on_apply='always', conflict_log_destination='table') sets both fields correctly).

- catversion.h: bumped past current master (202607023).


I validated the benchmark claims again, this time in EC2 on larger "metal" instance: m6id.metal - 128 vCPU, 512 GB RAM, 4×1.7 TB local NVMe (RAID0), Amazon Linux 2023. PG 20devel release build (cassert=off).

Result (origin/master vs tepid v50, scale 50, 32c/32t, 120s/cell):

workload                           TPS  master->tepid      WAL/update master->tepid
simple_update (control; HOT both)  132.9k -> 131.9k ( -1%)  448 ->  448 B ( +0%)
hot_indexed_update (1 of 4 idx)    172.4k -> 195.0k (+13%)  556 ->  422 B (-24%)
hot_indexed_mixed (80r/20w)        333.4k -> 346.8k ( +4%)  574 ->  438 B (-24%)
read_indexscan (read-only)         812.2k -> 803.5k ( -1%)  n/a (read-only)
wide, 0 of 17 (control)            214.2k -> 213.6k ( -0%)  141 ->  143 B ( +1%)
wide, 1 of 17 indexes               93.8k -> 164.6k (+76%) 1649 ->  668 B (-59%)
wide, 4 of 17 indexes               93.7k -> 147.1k (+57%) 1783 ->  978 B (-45%)
wide, 8 of 17 indexes               98.8k -> 132.7k (+34%) 1967 -> 1494 B (-24%)
wide, 16 of 17 indexes             106.3k -> 106.8k ( +0%) 3222 -> 3219 B ( -0%)


best.

-greg