MP006critical

no-vacuum-full

VACUUM FULL rewrites the entire table under ACCESS EXCLUSIVE lock, blocking all reads and writes.

operation
Tables
lock taken
ACCESS EXCLUSIVE
remediation
Manual rewrite
category
Lock safety

What triggers it

Fires on any VacuumStmt whose options array contains a DefElem named fullVACUUM FULL, with or without an explicit table list.

What does not

Plain VACUUM or VACUUM (ANALYZE) without the FULL option never matches — the rule only looks for the full DefElem. Non-VacuumStmt statements return immediately too.

Where it applies

Applies to every PostgreSQL version MigrationPilot targets. It works on the SQL text alone — no database connection needed.

The lock, and what it blocks

VACUUM FULL rewrites the table to a new file under ACCESS EXCLUSIVE for the entire operation, blocking every read and write until it finishes — the doc notes this can take hours on a large table.

Why it matters

VACUUM FULL physically rewrites the entire table to reclaim disk space while holding an ACCESS EXCLUSIVE lock. Use pg_repack or VACUUM (without FULL) instead for online space reclamation.

Unsafe, and safe

Flagged

VACUUM FULL users;

Safe alternative

-- Use regular VACUUM (no lock) or pg_repack
VACUUM users;

What it assumes

The rule fires regardless of table size or actual bloat level, so a VACUUM FULL on a small or already-compact table is flagged the same as one on a huge bloated table where the lock genuinely matters.

What the CLI prints

migrationpilot analyze migration.sql
✗ [MP006] CRITICAL (line 1)
  VACUUM FULL on "users" rewrites the entire table under ACCESS EXCLUSIVE lock. This blocks ALL reads and writes for the entire duration.

  Safe alternative:
  -- Use pg_repack instead (no ACCESS EXCLUSIVE lock during rewrite):
  -- Install: CREATE EXTENSION pg_repack;
  -- Run: pg_repack --table users --no-superuser-check

  Why: VACUUM FULL rewrites the entire table to a new file, holding an ACCESS EXCLUSIVE lock for the full duration. On large tables this can take hours. Use regular VACUUM or pg_repack for online table compaction instead.
  Docs: https://migrationpilot.dev/rules/mp006

Generated by running the CLI's own formatter over the flagged example above, so it is the text the tool actually produces. A real run also reports the other rules that fire on the same statement; those blocks are left out here.

Turning it off

For one statement, put a comment on the line before it:

-- migrationpilot-disable MP006
VACUUM FULL users;

For the whole project, in .migrationpilotrc.yml — by name or by id:

.migrationpilotrc.yml
rules:
  MP006: false

# or keep it, and downgrade it
rules:
  MP006:
    severity: warning

Try it

Open this rule's flagged example in the playground. It runs in your browser — edit it and watch the finding appear and disappear.

Run MP006 in the playground

Related rules