MP072WARNINGFree
warn-partition-default-scan
What It Detects
ATTACH PARTITION scans the DEFAULT partition under ACCESS EXCLUSIVE lock to check for overlapping rows.
Why It's Dangerous
When attaching a new partition, PostgreSQL scans the entire DEFAULT partition while holding an ACCESS EXCLUSIVE lock on it. If the default partition is large, this blocks all reads and writes.
Bad Example
ALTER TABLE events ATTACH PARTITION events_2024
FOR VALUES FROM ('2024-01-01') TO ('2025-01-01');Good Example
-- Move rows from default partition first, then attach:
SET lock_timeout = '5s';
ALTER TABLE events ATTACH PARTITION events_2024
FOR VALUES FROM ('2024-01-01') TO ('2025-01-01');
RESET lock_timeout;Configuration
Disable this rule:
# .migrationpilotrc.yml rules: MP072: false
Or change its severity:
# .migrationpilotrc.yml
rules:
MP072:
severity: warning