From 769ba54309ab1b97e0a49aa19401e657400c33f6 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 12 Sep 2026 13:42:44 +0000 Subject: [PATCH 1/2] Add pg_repack, so bloated tables can be rewritten without downtime The meta dedup deleted 206,838,911 rows from meta and a similar number from track_meta. Deletes do not return space: meta is still a 62 GB heap holding 180.6M rows, with roughly 50 GB of hole in it and another 25 GB in track_meta. Autovacuum will not recover it either -- plain VACUUM only truncates free space at the physical end of a table, and meta's tail is the native-gid era where every row survived, so there is nothing there to truncate. That leaves VACUUM FULL, which holds an ACCESS EXCLUSIVE lock for the entire rewrite. On a 97 GB table that is half an hour or more with metadata lookups failing, which is not a thing to do to a live service to recover disk that is merely untidy rather than scarce. pg_repack does the same rewrite online, taking brief locks only at the start and end. Installed from PGDG as postgresql-$PG_MAJOR-repack, next to wal2json, which brings both the extension and the client binary; the binary lands in /usr/lib/postgresql/$PG_MAJOR/bin, already on PATH in this image. Verified postgresql-18-repack 1.5.3-1 exists in PGDG for both bookworm and trixie, so this does not depend on which suite the base image tracks. The extension still has to be created per database before use. --- CHANGELOG.md | 6 ++++++ Dockerfile | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72fb20a..d3ae6be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- pg_repack, so bloated tables can be rewritten online. VACUUM FULL holds an + ACCESS EXCLUSIVE lock for the whole rewrite, which takes the table offline; + pg_repack only needs brief locks at the start and end. Ships both the + extension and the client binary. + ### Changed - Removed Stolon. diff --git a/Dockerfile b/Dockerfile index 7cf1d75..9d09bc1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,7 +59,8 @@ RUN apt-get update && \ sshpass \ pv \ gettext-base \ - postgresql-$PG_MAJOR-wal2json + postgresql-$PG_MAJOR-wal2json \ + postgresql-$PG_MAJOR-repack COPY setup_db.sh /docker-entrypoint-initdb.d/setup_db.sh From 7bd7d975261f171b81b860074798fd8574720afd Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 12 Sep 2026 15:01:24 +0000 Subject: [PATCH 2/2] Trim the changelog entry to what changed --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ae6be..fb6f66f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- pg_repack, so bloated tables can be rewritten online. VACUUM FULL holds an - ACCESS EXCLUSIVE lock for the whole rewrite, which takes the table offline; - pg_repack only needs brief locks at the start and end. Ships both the - extension and the client binary. +- Include pg_repack in the Docker image. ### Changed - Removed Stolon.