RemoveSubscriptionRel() by index: measurements ============================================== Base: master 7fc2f0423320e02beb8c44b863f1827604c47c75, with and without v1-0001. Builds: -O2 -g, no assertions, same configure for both. Host: Ryzen AI 9 HX 370 (Zen 5 cores 0-3,12-15 pinned), Linux 7.3. Method: both builds run on byte-identical clones of the same cluster, alternating per round (m p, p m, ...), 6 rounds. Instructions are instructions:u of the backend (perf stat -p) for the measured statements only; ms is the client's wall clock. "change" is the median of patched against master with a bootstrap 95% CI. Subscriber setup (script: subrel-measure.py.txt, op tpl): K rows in pg_subscription_rel = K/1000 subscriptions (connect = false) x 1000 tables, state 'r', added with binary_upgrade_add_sub_rel_state() in a single-user -b session, as pg_upgrade does. Scans of pg_subscription_rel per DROP TABLE (op census, K=100000): table "text + identity PK": master 3 heap scans, patched 3 index scans (the table, its TOAST table, its identity sequence) table "int": master 1 heap scan, patched 1 index scan 1) DROP SCHEMA ... CASCADE of 1000 tables (id int GENERATED ALWAYS AS IDENTITY PRIMARY KEY, v text). op drop. 2) One session runs 300 transactions of BEGIN; CREATE TEMP TABLE t (id int, v text) ON COMMIT DROP; INSERT INTO t SELECT g, 'x' FROM generate_series(1, 10) g; COMMIT; reported per transaction. op tempi. The ms of this run are dominated by the commit's WAL flush and are noisy (the run ended with the noise sentinel above its threshold); the instruction counts do not depend on that. op size metric master patch change [95% CI] n drop 0 instr (M) 2,297 2,310 +0.6% [+0.5..+0.6] 6/6 drop 0 ms 222 231 +4.0% [-3.0..+12.8] 6/6 drop 1000 instr (M) 2,942 2,317 -21.2% [-21.3..-21.2] 6/6 drop 1000 ms 259 241 -7.2% [-11.3..+1.0] 6/6 drop 10000 instr (M) 8,706 2,319 -73.4% [-73.4..-73.4] 6/6 drop 10000 ms 487 222 -54.3% [-56.1..-49.7] 6/6 drop 100000 instr (M) 66,330 2,320 -96.5% [-96.5..-96.5] 6/6 drop 100000 ms 2,766 230 -91.7% [-91.9..-91.3] 6/6 tempi 1000 instr/tx (M) 2.961 2.545 -14.0% [-14.0..-14.0] 6/6 tempi 1000 ms/tx 8.401 6.819 -18.8% [-33.8..+8.0] 6/6 tempi 10000 instr/tx (M) 6.804 2.546 -62.6% [-62.6..-62.6] 6/6 tempi 10000 ms/tx 7.753 7.873 +1.6% [-36.1..+36.9] 6/6 tempi 100000 instr/tx (M) 45.2 2.547 -94.4% [-94.4..-94.4] 6/6 tempi 100000 ms/tx 10.5 8.470 -19.5% [-44.7..+9.7] 6/6 Reading: the patched cost is flat in K. With K = 0 the index scan costs about 13M instructions more per 3000 lookups (~4,400 per dropped relation); master's heap scan is cheaper only while pg_subscription_rel is (nearly) empty. The ms difference at K = 0 is within noise. Not measured: ALTER SUBSCRIPTION ... REFRESH PUBLICATION timing (it goes through the same function with both keys; correctness covered by the existing subscription TAP tests, which fail if the keys are put in the wrong order); other platforms.