What is this issue?
The track_counts setting controls whether PostgreSQL collects statistics
about table and index activity. This data is used by:
- Autovacuum: To decide when tables need vacuuming
- pg_stat_user_tables: Row counts, dead tuples, scan counts
- pg_stat_user_indexes: Index usage statistics
- Query planner: For cost estimation
With track_counts disabled:
- Autovacuum cannot make informed decisions
- You can't see table/index statistics
- PG Pilot cannot provide accurate metrics
Why it matters
Broken Autovacuum
Autovacuum can't determine which tables need maintenance
No Statistics
pg_stat views show zeros or nulls
Blind Monitoring
Can't see table activity or dead tuple counts
Poor Planning
Query planner lacks runtime statistics
How PG Pilot detects it
```sql SELECT name, setting FROM pg_settings WHERE name = 'track_counts'; ```
How to fix it
Enable track_counts
This requires a server restart:
ALTER SYSTEM SET track_counts = on;Then restart PostgreSQL.
Verify statistics collection
After restart, check that statistics are being collected:
SELECT * FROM pg_stat_user_tables LIMIT 5;Values should be non-zero for active tables.
Run ANALYZE
Rebuild table statistics:
ANALYZE;Prevention
- Never disable track_counts in production
- Use configuration management to enforce this setting
- Monitor with PG Pilot for configuration drift