Copy PostgreSQL databases with zstd before updates

pg_dump -Fc -Z zstd:1 instead of its default gzip: on the dev Core a
1.3 GB database took 6 s and 158 MB instead of 27 s and 223 MB, and
restores as fast. A pg_dump without zstd falls back to its default. The
"takes a while" note now starts at 1 GB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 21:18:00 -07:00
co-authored by Claude Opus 5.5
parent 5d90c246a1
commit 1e86866e8a
3 changed files with 37 additions and 10 deletions
+15 -5
View File
@@ -570,13 +570,23 @@ Later:
- Large databases (2026-12-03): before dumping, coreapps reads the
database's size (`pg_database_size`; MariaDB's `information_schema`
table sizes) and refuses the update, changing nothing, if the apps'
disk can't hold the copy and still keep 1 GB free; above 200 MB it
says the copy takes a while, and above 30 seconds how long it took.
disk can't hold the copy and still keep 1 GB free; above 1 GB (200 MB
before zstd) it says the copy takes a while, and above 30 seconds how long it took.
Tested on dev.fedcom.net (sizes, the refusal with a raised reserve, the
message with a lowered limit)
- [ ] Very large databases: a dump on every update may still be too
slow; a btrfs snapshot of the database server's data, or skipping
the copy with the user's agreement, could replace it
- Done 2026-12-03: PostgreSQL dumps use zstd at level 1 (`pg_dump
-Fc -Z zstd:1`; pg_dump's default compression if it fails, for a
PostgreSQL without zstd). Measured on dev.fedcom.net with a 1.3 GB
database: gzip (the default) 27.2 s / 223 MB, lz4 5.2 s / 363 MB,
zstd:1 6.4 s / 158 MB, none 7.5 s / 896 MB; restoring each took
28-34 s (mostly index builds). A whole update of an app with that
database took 26 s; a failed one rolled back with all 4.5 million
rows (2 minutes)
- [ ] Very large databases (tens of GB): even at ~5 s/GB the copy
grows with the data; a btrfs snapshot can't replace it (the server's
data is shared by all apps), so skipping the copy with the user's
agreement would be next, if a Core needs it. A faster rollback:
`pg_restore -j` (needs the dump as a file in the container)
- Done 2026-12-03: dropping a need from an installed app. `sso` and
`email` go freely; `postgres`/`mysql` (the app's data) need
`--drop-database` (coreapps install/plan; `coreapp deploy` asks for the