vacuum-full-cluster
errorVACUUM FULL / CLUSTER
Why it's unsafe
VACUUM FULL and CLUSTER rewrite the entire table under an ACCESS EXCLUSIVE lock — minutes to hours of blocked reads and writes, plus 2x disk.
Safe rewrite
On PostgreSQL 19+, rebuild online with REPACK (CONCURRENTLY): it takes ACCESS EXCLUSIVE only briefly to swap files while allowing concurrent reads and writes (requires a primary key; not for partitioned or unlogged tables, and must run outside a transaction block). On earlier versions use the pg_repack extension. To only reclaim bloat, plain VACUUM (no FULL) takes just SHARE UPDATE EXCLUSIVE and allows concurrent reads and writes.
Example
Try it in the playground →Unsafe
VACUUM FULL users;