Destructive Operations

VACUUM FULL

Lock mode ACCESS EXCLUSIVE
Risk HIGH
Blocks reads, writes, other DDL
pgfence rule vacuum-full
VACUUM FULL orders;

What this does

Rewrites the entire table to reclaim space, holding ACCESS EXCLUSIVE for the full duration. Unlike plain VACUUM (SHARE UPDATE EXCLUSIVE, non-blocking), FULL blocks all reads and writes.

Safe rewrite

Use pg_repack for an online table rewrite that does not hold ACCESS EXCLUSIVE

-- pg_repack --table orders --no-superuser-check

Read more

More in Destructive Operations