> ## Content Index
> Fetch the complete content index at: https://sudosecurity.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# PostgreSQL 19 Is Out. REPACK Kept My Writes Running. The Docker Upgrade Will Stop Your App.
- URL: https://sudosecurity.org/postgresql-19-repack-upgrade-self-hosting/
- Published: 2026-11-27T18:00:00.000Z
- Updated: 2026-11-27T18:00:00.000Z
- Description: PostgreSQL 19 shipped on November 19 with REPACK (CONCURRENTLY), which removes table bloat without blocking writes. I measured it against VACUUM FULL, ran the upgrade from 18, and checked what breaks for self-hosters: Docker tags that refuse to start, a config setting that stops the server, and...
- Author: Santhdium
- Tags: PostgreSQL, Databases, Docker, Containers, SQL, DevOps, Tutorials, Open Source

Every self-hosted app with a database eventually gets a fat table. Photos get deleted, documents get re-indexed, a log table churns, and the file on disk stays the size of its worst day. The only real fix used to be `VACUUM FULL`, which locks the table for as long as it runs. For a homelab that means scheduling downtime for your photo library.

PostgreSQL 19, released November 19, adds `REPACK (CONCURRENTLY)`, which does the same job while the table stays writable. I ran it against `VACUUM FULL` under load, upgraded an 18 database to 19 the way Docker users have to, and listed what will trip you up.

## What's New in PostgreSQL 19 for Self-Hosters

The announcement leads with `REPACK`, a new plan-stability extension called `pg_plan_advice`, and read-your-writes on standbys with `WAIT FOR LSN`. For a single-server homelab, the defaults matter more. I checked each one on a fresh 19.0 cluster:

| Setting                             | PostgreSQL 19 default | What changed                                                    |
| ----------------------------------- | --------------------- | --------------------------------------------------------------- |
| jit                                 | off                   | Was on. The project says its cost estimates "proved unreliable" |
| default\_toast\_compression         | lz4                   | Was pglz, on builds with LZ4 support                            |
| io\_min\_workers / io\_max\_workers | 2 / 8                 | Replace io\_workers, which no longer exists                     |
| md5\_password\_warnings             | on                    | A warning after every successful md5 login                      |
| max\_repack\_replication\_slots     | 5                     | New. Limits concurrent REPACK (CONCURRENTLY) runs               |
| RADIUS authentication               | removed               | pg\_hba.conf lines using it must go                             |

Two of these can stop an upgrade. If your `pg_hba.conf` still uses RADIUS, that method is gone. And if your `postgresql.conf` sets `io_workers`, 19 won't start at all. More on that below.

The md5 warning is advance notice. md5 password authentication was deprecated in 18 and "will be removed in a future release." If an app's database user still has an md5 password, reset it under the default `scram-sha-256` now.

## REPACK vs VACUUM FULL, Measured

I built a table with 8 million rows, updated every row, deleted half, and ran a plain `VACUUM`. That left 4 million live rows in a 2,156 MB table with 343 MB of indexes, about three-quarters of it dead space. Then I started 4 clients updating random rows by primary key for 60 seconds, ran the maintenance command 5 seconds in, and logged writes per second.

Each command ran twice, on a fresh copy of the bloated table each time. The machine was a 2-vCPU cloud VM with 7 GB of RAM.

|                          | VACUUM FULL                  | REPACK (CONCURRENTLY) |
| ------------------------ | ---------------------------- | --------------------- |
| Duration                 | 5.7 s, 5.9 s                 | 7.4 s, 7.3 s          |
| Table after              | 548 MB                       | 548 to 549 MB         |
| Indexes after            | 86 MB                        | 86 MB                 |
| Writes per second before | about 6,500 to 8,000         | about 6,500 to 8,000  |
| Writes per second during | **0** for 4 straight seconds | 1,750 to 2,800        |
| Worst single second      | 0                            | 254 to 355            |

`VACUUM FULL` is faster because nothing else is allowed to happen. For four seconds every writer waited. `REPACK (CONCURRENTLY)` took a quarter to a third longer and never stopped writes. They ran at roughly a third of normal speed, with a couple of slow seconds near the end, when it takes the exclusive lock to swap files. Both shrank the table to about 548 MB.

On a 2 GB table that's a four-second stall either way. On a 200 GB table it's the difference between a maintenance window and a Tuesday afternoon.

> **We recommend reading** [Postgres 19 Is Late Because LLMs Found Forty Years of Bugs](https://sudosecurity.org/postgres-19-delayed-llm-code-review/) to continue reading our selection of content. It covers why this release came out in November instead of September.

[Postgres 19 Is Late Because LLMs Found Forty Years of Bugs](https://sudosecurity.org/postgres-19-delayed-llm-code-review/) PostgreSQL 19 slipped to November after LLM-assisted review surfaced more bugs than committers could fix. The commit data and what it means. SudoSecurity · Santhdium

### What REPACK (CONCURRENTLY) won't do

The documentation lists the limits. Two of them will catch self-hosters:

- **It needs a primary key or replica identity index.** On a table without one, I got: `ERROR: cannot execute REPACK (CONCURRENTLY) on relation "nopk"` and `DETAIL: Relation "nopk" has no identity index.`
- **It isn't MVCC-safe.** The docs warn that after it commits, "the table will appear empty to concurrent transactions, if they are using a snapshot taken before repacking started." Don't run it during a long `pg_dump` of the same database.

It also can't run on partitioned, unlogged, or system tables, or inside a transaction block. It needs free disk equal to the table plus its indexes, because it writes a full copy first.

It uses a replication slot to capture changes made while it runs, which is what `max_repack_replication_slots` limits, but I didn't have to change `wal_level`. My cluster ran at the default `replica` throughout, and `effective_wal_level` still read `replica` afterward.

## The Docker Upgrade Problem

Here's what most self-hosters will actually hit. Starting with the 18 images, the official `postgres` Docker images store data in a version-numbered directory, `/var/lib/postgresql/18/docker`, under a single volume at `/var/lib/postgresql`. The 19 image looks in `/var/lib/postgresql/19/docker`.

So if your compose file uses a floating tag like `postgres:latest` or `postgres:alpine`, the next pull after Docker Hub publishes 19 points a 19 server at an 18 volume. I simulated that, with a stand-in image built from `postgres:18.7` plus the PGDG 19.0 packages, since the official 19 image couldn't be pulled when I tested. The entrypoint refused to start:

```
Error: in 18+, these Docker images are configured to store database data in a
       format which is compatible with "pg_ctlcluster" (specifically, using
       major-version-specific directory names).  This better reflects how
       PostgreSQL itself works, and how upgrades are to be performed.

       See also https://github.com/docker-library/postgres/pull/1259

       Counter to that, there appears to be PostgreSQL data in:
         /var/lib/postgresql/18/docker

```

Your data is safe. That's the point of the check, which comes straight from the image's `docker-entrypoint.sh`. But your app is down until you either pin the tag back to 18 or do the upgrade.

What popular example compose files use:

| App's example compose           | Postgres image                                                 | On the next pull                                        |
| ------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------- |
| Immich                          | ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0 | Stays on 14, which got its final release on November 12 |
| Paperless-ngx                   | postgres:18                                                    | Stays on 18                                             |
| Nextcloud (nginx-proxy example) | postgres:alpine                                                | Moves to 19 and refuses to start                        |

Pin the major version. `postgres:18` gets every 18.x security fix and never jumps to 19 on its own. The `19` tag showed up on Docker Hub at 01:08 UTC on November 20, with no amd64 image behind it yet. `latest` still pointed at the same image as `18` when I checked an hour later, so the floating tags haven't moved, but they will.

## Upgrading 18 to 19 on the Same Volume

The new layout exists so `pg_upgrade --link` works inside one volume. `pg_upgrade` needs both versions installed, which no official image has, so I built a temporary image from `postgres:18.7` with the PGDG `postgresql-19` package added. With the database container stopped, I ran this as the `postgres` user against the volume:

```bash
#!/bin/bash
# Upgrade an 18 data directory to 19 on the same Docker volume with pg_upgrade --link.
# Runs as the postgres user in an image that has both 18 and 19 installed.
set -e
cd /var/lib/postgresql
/usr/lib/postgresql/19/bin/initdb -D 19/docker -U postgres --data-checksums > /dev/null
/usr/lib/postgresql/19/bin/pg_upgrade \
  -b /usr/lib/postgresql/18/bin -B /usr/lib/postgresql/19/bin \
  -d 18/docker -D 19/docker -U postgres --link
cp 18/docker/pg_hba.conf 19/docker/pg_hba.conf

```

It ended with `Upgrade Complete`, and a 19 container on the same volume started and returned all 1,000 rows of my test table. Three things to know:

- **Copy `pg_hba.conf`.** The image only writes its "allow other containers" rule when it creates a new cluster. A cluster made by `initdb` for the upgrade doesn't have it, so your app container can't connect until you copy the file over.
- **Copy your settings.** Anything you changed in the old `postgresql.conf` doesn't carry over. Move it by hand, and drop `io_workers` while you're there.
- **Run the stats commands.** `pg_upgrade` printed two `vacuumdb` commands to run afterward, because it doesn't transfer every statistic. Until they finish, query plans can be bad.

I timed the upgrade modes on a separate 659 MB database with 4 million rows and two indexes:

| Method                             | Time   |
| ---------------------------------- | ------ |
| pg\_upgrade --swap                 | 2.03 s |
| pg\_upgrade --link                 | 2.48 s |
| pg\_upgrade --copy                 | 2.89 s |
| pg\_dumpall piped into a 19 server | 6.54 s |

At this size everything is fast, because the files fit in the page cache. The gap grows with the data. `--link` and `--swap` barely depend on database size, while copy and dump-and-restore scale with it. The trade-off: after `--link` or `--swap`, the old 18 cluster can't be started safely, so take a backup first.

### The setting that stops 19 from starting

PostgreSQL 19 replaced `io_workers` with `io_min_workers` and `io_max_workers`. I added `io_workers = 3` to a 19 cluster's config, the kind of line a tuned 18 config might carry over, and the server refused to start:

```
LOG:  unrecognized configuration parameter "io_workers" in file "/var/lib/postgresql/up/d19/postgresql.conf" line 934
FATAL:  configuration file "/var/lib/postgresql/up/d19/postgresql.conf" contains errors

```

If you pass settings as `command: postgres -c io_workers=...` in compose, it's the same problem in a different place.

> **We recommend reading** [The Complete Self-Hosted Productivity Stack: Nextcloud, Vaultwarden, Immich, Jellyfin, and Paperless in 2026](https://sudosecurity.org/self-hosted-productivity-stack-nextcloud-vaultwarden-immich-jellyfin-paperless-2026/) to continue reading our selection of content. Three of those apps keep everything in Postgres, so check their database tags before you upgrade.

[The Complete Self-Hosted Productivity Stack: Nextcloud, Vaultwarden, Immich, Jellyfin, and Paperless in 2026](https://sudosecurity.org/self-hosted-productivity-stack-nextcloud-vaultwarden-immich-jellyfin-paperless-2026/) Replace Google Drive, Google Photos, 1Password, Plex, and your document scanner with a self-hosted stack that runs on your hardware. SudoSecurity · Santhdium

## Should You Upgrade Now?

Check your extensions first. On November 19, the PGDG apt repository for Debian 13 had 82 extension packages built for 19, against 114 for 18\. The 32 not yet available include TimescaleDB, repmgr, pgpool2, RUM, Apache AGE and PL/Java. pgvector, PostGIS, pg\_cron, pgaudit and pg\_partman are already there.

For a homelab I'd wait for the official Docker image, then for your app's own guidance. Immich, for one, ships its own Postgres image with VectorChord built in, and that image decides when you can move. If your stack is plain Postgres with no unusual extensions, 19 is a reasonable upgrade once the official image is out, and `REPACK (CONCURRENTLY)` alone is worth it.

If you're on 14, that's the urgent one. It got its final release on November 12.

The [end-of-life dates guide](https://sudosecurity.org/database-eol-2026-migration-guide/) covers the other databases in a typical stack.

## What This Doesn't Cover

I tested PGDG's 19.0 Debian packages in a stand-in image built from `postgres:18.7`, not the official 19 Docker image, which had no pullable amd64 image when I ran the tests. The entrypoint behavior comes from docker-library's `docker-entrypoint.sh`, which is identical in its 18 and 19 directories.

The REPACK numbers are from one table shape on a small VM with everything in RAM. Bigger tables and real disks will change the times, but probably not the shape: one locks, one doesn't. I didn't test `pg_plan_advice`, `WAIT FOR LSN`, the new SNI support, or logical replication changes. Immich's VectorChord image and other app-specific Postgres builds aren't covered beyond their tags.

## The Actual Point

`REPACK (CONCURRENTLY)` turns bloat cleanup from a maintenance window into a command you can run on a weekday. It's the best reason to move to 19.

The upgrade is where self-hosters get hurt. Pin your Postgres image to a major version before `latest` moves to 19\. When you do upgrade, use `pg_upgrade --link` on the single volume the 18+ images were designed for, copy `pg_hba.conf`, drop `io_workers`, and check your extensions are built for 19 first.

*Release details and quotes are from the* [*PostgreSQL 19 release announcement*](https://www.postgresql.org/about/news/postgresql-19-released-3449/?ref=sudosecurity.org) *and the* [*REPACK documentation*](https://www.postgresql.org/docs/19/sql-repack.html?ref=sudosecurity.org)*. The entrypoint error is reproduced from a real run, and its check comes from docker-library's* [*docker-entrypoint.sh*](https://github.com/docker-library/postgres/blob/master/18/trixie/docker-entrypoint.sh?ref=sudosecurity.org) *and the* [*18*](https://github.com/docker-library/postgres/blob/master/18/trixie/Dockerfile?ref=sudosecurity.org) *and* [*19*](https://github.com/docker-library/postgres/blob/master/19/trixie/Dockerfile?ref=sudosecurity.org) *Dockerfiles. Compose image tags are from the Immich, Paperless-ngx and Nextcloud example compose files on their main branches. Extension counts are from the apt.postgresql.org `trixie-pgdg` package index. All tests ran on November 19, 2026 with PostgreSQL 19.0 (`19.0-1.pgdg13+1`) and 18.7 on a 2-vCPU, 7 GB KVM guest. The upgrade script is original code using `initdb` and `pg_upgrade` as documented, and every output, size and timing is reproduced from those runs.*