MP032CRITICALFree

ban-cluster

What It Detects

CLUSTER rewrites the entire table under ACCESS EXCLUSIVE lock.

Why It's Dangerous

CLUSTER physically reorders all table rows to match an index, requiring a full table rewrite under ACCESS EXCLUSIVE. Use pg_repack for online table clustering.

Bad Example

CLUSTER users USING idx_users_created;

Good Example

-- Use pg_repack for online clustering

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP032: false

Or change its severity:

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