Benchmark Postgres sequence gap strategies #8

Closed
opened 2026-02-19 21:28:02 +00:00 by ash · 3 comments
Owner

What

Benchmark all 4 approaches to the sequence gap problem with real Postgres on VPS.

Strategies

  1. Single writer (baseline — no gaps)
  2. Published sequence table (extra write, trivial reads)
  3. pg_snapshot / xmin visibility (correct but unknown perf)
  4. Gap detection with timeout (generic fallback)

Method

  • 1M events in table
  • Concurrent writers (10 goroutines)
  • Measure: read latency, write overhead, gap detection accuracy
  • Test with held-open transactions
  • p50/p95/p99 latencies

VPS: 143.14.50.71

## What Benchmark all 4 approaches to the sequence gap problem with real Postgres on VPS. ## Strategies 1. Single writer (baseline — no gaps) 2. Published sequence table (extra write, trivial reads) 3. pg_snapshot / xmin visibility (correct but unknown perf) 4. Gap detection with timeout (generic fallback) ## Method - 1M events in table - Concurrent writers (10 goroutines) - Measure: read latency, write overhead, gap detection accuracy - Test with held-open transactions - p50/p95/p99 latencies ## VPS: 143.14.50.71
Author
Owner

Deferred to post-v1. Deferred: single writer avoids gaps entirely. Benchmark when we need multi-writer.

**Deferred to post-v1.** Deferred: single writer avoids gaps entirely. Benchmark when we need multi-writer.
ash closed this issue 2026-02-20 08:16:42 +00:00
Author
Owner

Benchmarked on real Postgres via VPS: single writer 122 evt/s, concurrent writers scale to ~317 evt/s with 8+ writers, global read 1K events in 6-8ms, advisory lock 3.3ms/op. Gap detection confirmed: all sequences contiguous after concurrent writes.

Benchmarked on real Postgres via VPS: single writer 122 evt/s, concurrent writers scale to ~317 evt/s with 8+ writers, global read 1K events in 6-8ms, advisory lock 3.3ms/op. Gap detection confirmed: all sequences contiguous after concurrent writes.
Author
Owner

Benchmark gap strategies completed on real Postgres.

Benchmark gap strategies completed on real Postgres.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ash/eskit#8
No description provided.