GiST intrapage-indexing -- concurrency A/B (bench/concurrency_bench.sh) ======================================================================= Question (from the review of gistplacetopage): do concurrent inserts that descend THROUGH a skip tuple hurt lock contention, throughput, or bloat vs plain GiST? Setup: preload 3,000,000 random points + GiST index, then 8 concurrent pgbench clients each insert 100,000 single rows (800,000 inserts total, same work on both builds). A background sampler polls pg_stat_activity wait events every ~20 ms during the run. fsync=off, shared_buffers=2GB, autovacuum=off. base = 11591f273e6, gist = e9689a3f633. SPREAD (KEYRANGE=1,000,000 -- inserts scattered across the whole tree) time tps idx grew free% leaf/internal top waits base 8.29s 96686 +51.0 MB 32.9 30770/266 WALWrite280 ClientRead191 WalInsert48 SpinDelay39 gist 8.05s 99597 +51.5 MB 32.9 30787/276 WALWrite282 ClientRead192 WalInsert36 SpinDelay30 HOTSPOT (KEYRANGE=2,000 -- all 8 clients funnel into ONE tiny region, i.e. the same subtree / internal page / skip group: the adversarial case) time tps idx grew free% leaf/internal top waits base 7.92s 101173 +49.5 MB 32.4 30558/261 WALWrite247 ClientRead214 SpinDelay23 WalInsert17 gist 7.77s 103128 +49.4 MB 32.4 30548/271 WALWrite222 ClientRead214 SpinDelay39 WalInsert29 Findings -------- * Throughput: gist is slightly FASTER in both workloads (~3% spread, ~2% hotspot) -- consistent with the cheaper insert descent seen elsewhere. Not a regression. * Bloat / size: identical. Same free_percent (32.9 / 32.4), same index growth (+51 MB / +49 MB), same leaf/internal page counts to within ~10 internal pages (the skip-tuple overhead). Concurrent inserts through skip tuples do not bloat the index more than plain GiST. * Lock contention: the wait-event profile is the SAME on both builds and is dominated by WAL (WALWrite / WALInsert / WalWrite) and ClientRead -- NOT by LWLock:BufferContent or LockManager. No index-page lock contention emerges on either build, even in the hotspot run. The patch adds no new lock: skip tuples live on the same internal page as the downlinks and are read under the same buffer lock, so descent locking is unchanged. Caveat: fsync=off makes WAL flushing the bottleneck at this insert rate, which is why WAL waits dominate. That is identical for both builds, so the A/B comparison (no added contention, no added bloat) holds; it just means this test does not stress disk. Re-running with fsync=on would raise absolute WAL waits equally on both and is not expected to change the base-vs-gist verdict.