PostgreSQL 19 introduces REPACK command and autovacuum prioritization
Key Takeaway
PostgreSQL 19 adds a new REPACK command for table rebuilding and a weighted scoring system to prioritize autovacuum tasks.
Summary
As part of the PostgreSQL 19 CommitFest, new features aim to improve database administration and maintenance. The update introduces the REPACK command, which includes a CONCURRENTLY option to rebuild tables without blocking writes, and a new scoring mechanism for autovacuum to process relations based on configurable weights.
Maintenance and Administration Improvements
- REPACK command: Combines functionality of VACUUM FULL and CLUSTER; the
CONCURRENTLYoption uses logical decoding to capture changes during rebuilding to avoid exclusive locks. - Autovacuum prioritization: Replaces arbitrary processing order with a scoring system based on five criteria (XID age, multixact age, dead tuples, inserted tuples, and modified tuples).
- Configurable weights: New
autovacuum_*_score_weightparameters allow administrators to prioritize specific vacuuming criteria. - Monitoring: A new
pg_stat_autovacuum_scoresview provides visibility into individual and overall autovacuum scores.
Why it matters
These changes reduce downtime for large table maintenance and provide DBAs with more granular control over background maintenance tasks.
Original reference: postgr.es →