Re: Tepid: selective index updates for heap relations

From: "Greg Burd" <greg(at)burd(dot)me>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tepid: selective index updates for heap relations
Date: 2026-07-02 16:40:51
Message-ID: 57c9e23a-bb03-4d7c-81f5-551cd42f8b34@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v50-0001-Add-tests-to-cover-a-variety-of-heap-HOT-update-.patch text/x-patch 45.4 KB
v50-0002-Identify-modified-indexed-attributes-in-the-exec.patch text/x-patch 62.2 KB
v50-0003-Add-the-HOT-indexed-on-disk-format-inline-attr-b.patch text/x-patch 12.8 KB
v50-0004-Add-HOT-indexed-updates-selective-index-maintena.patch text/x-patch 228.7 KB
v50-0005-Collapse-dead-HOT-indexed-chains-to-xid-free-stu.patch text/x-patch 53.2 KB
v50-0006-Teach-amcheck-to-recognize-HOT-indexed-chains-an.patch text/x-patch 17.7 KB
v50-0007-Add-HOT-indexed-statistics-and-the-comprehensive.patch text/x-patch 165.5 KB
v50-0008-Gate-HOT-indexed-updates-on-the-logical-replicat.patch text/x-patch 116.3 KB
v50-0009-DO-NOT-MERGE-Add-a-HOT-SIU-benchmark-harness.patch text/x-patch 33.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-07-02 17:54:00 Re: satisfies_hash_partition crash
Previous Message Marcos Pegoraro 2026-07-02 16:35:41 Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements