From 344ac5f011ffdcd6ac20c4dbeddbadd004173c74 Mon Sep 17 00:00:00 2001 From: choiyounggi <74581798+choiyounggi@users.noreply.github.com> Date: Thu, 23 Jul 2026 13:06:54 +0900 Subject: [PATCH] ingest(databases): online schema changes + autovacuum/wraparound (from Postgres survival guide) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two gaps the databases domain didn't cover, both production-severe for a write-heavy startup, both cross-checked against the official PostgreSQL docs: - schema-design/online-schema-changes — avoiding the ACCESS EXCLUSIVE outage: non-volatile DEFAULT fast path, ADD CONSTRAINT NOT VALID + VALIDATE (SHARE UPDATE EXCLUSIVE), the CHECK-proves-NOT-NULL trick, CREATE INDEX CONCURRENTLY, ADD FOREIGN KEY's lighter lock, lock_timeout for lock-queue pileups, and expand-and-contract to decouple DB migration from app deploy. - operations/autovacuum-and-wraparound (new category) — per-table scale_factor/ cost_limit tuning for hot tables, age(datfrozenxid)/relfrozenxid + n_dead_tup monitoring, the ~3M-XID read-only cliff and superuser VACUUM recovery (not FULL/FREEZE), VACUUM FULL vs pg_repack. Registers both in databases/index.md (new operations category), appends log.md, and adds two-way related links from column-data-types and index-write-cost. Source: Hatchet "Postgres survival guide" + postgresql.org docs (sql-altertable, sql-createindex, routine-vacuuming). Independently fact-checked against the official docs; one default corrected (autovacuum_vacuum_scale_factor 0.2, not 0.1). --- log.md | 1 + wiki/databases/index.md | 7 +++ wiki/databases/indexing/index-write-cost.md | 2 +- .../operations/autovacuum-and-wraparound.md | 57 ++++++++++++++++++ .../schema-design/column-data-types.md | 2 +- .../schema-design/online-schema-changes.md | 58 +++++++++++++++++++ 6 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 wiki/databases/operations/autovacuum-and-wraparound.md create mode 100644 wiki/databases/schema-design/online-schema-changes.md diff --git a/log.md b/log.md index bcc206d..c9fd5a8 100644 --- a/log.md +++ b/log.md @@ -32,3 +32,4 @@ Append-only. Format: `## [YYYY-MM-DD]