MP067WARNINGFree

warn-backfill-no-batching

What It Detects

DELETE without a WHERE clause removes every row in a single transaction, generating massive WAL and holding locks.

Why It's Dangerous

A full-table DELETE generates a WAL entry for every row, bloats the table with dead tuples, and holds a ROW EXCLUSIVE lock for the entire duration. On tables with millions of rows, this can take hours, cause replication lag, and exhaust disk space.

Bad Example

DELETE FROM users;

Good Example

-- For full table delete, use TRUNCATE (much faster, minimal WAL):
TRUNCATE users;

-- For partial deletes, batch with WHERE + LIMIT:
DELETE FROM users WHERE ctid IN (
  SELECT ctid FROM users LIMIT 10000
);

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP067: false

Or change its severity:

# .migrationpilotrc.yml
rules:
  MP067:
    severity: warning