Laravel Packages
1 min read
PostgreSQL Monitoring and Schema Linting for Laravel with Vacuum
Keep your PostgreSQL databases performant with Vacuum, a Laravel package that tracks table bloat, autovacuum health, missing foreign key indexes, and slow query patterns.
Mastering PostgreSQL Performance with Vacuum
PostgreSQL is a favorite database among Laravel developers, but high-write workloads can lead to dead tuple accumulation, unindexed foreign keys, and table bloat that degrades query performance. Vacuum is a purpose-built package for monitoring and tuning PostgreSQL databases inside Laravel applications.
What Vacuum Checks
- Dead Tuple & Table Bloat: Monitors table fragmentation and alerts when autovacuum routines fail to keep pace with record updates.
- Missing Foreign Key Indexes: Identifies unindexed relation columns that trigger table-wide sequential scans during cascade operations.
- Transaction ID Wraparound: Keeps track of database transaction age to prevent catastrophic database shutdown states.
- Unused & Duplicate Indexes: Recommends obsolete indexes that consume write throughput and disk cache without improving query plans.
CLI Command Example
# Run complete PostgreSQL health audit
php artisan vacuum:check
# Inspect bloat on specific table
php artisan vacuum:bloat users