Chapter 26. Monitoring Database Activity

Table of Contents

26.1. Standard Unix Tools
26.2. The Statistics Collector
26.2.1. Statistics Collection Configuration
26.2.2. Viewing Statistics
26.2.3. pg_stat_activity
26.2.4. pg_stat_replication
26.2.5. pg_stat_wal_receiver
26.2.6. pg_stat_subscription
26.2.7. pg_stat_ssl
26.2.8. pg_stat_archiver
26.2.9. pg_stat_bgwriter
26.2.10. pg_stat_database
26.2.11. pg_stat_database_conflicts
26.2.12. pg_stat_all_tables
26.2.13. pg_stat_all_indexes
26.2.14. pg_statio_all_tables
26.2.15. pg_statio_all_indexes
26.2.16. pg_statio_all_sequences
26.2.17. pg_stat_user_functions
26.2.18. pg_stat_slru
26.2.19. Statistics Functions
26.3. Viewing Locks
26.4. Progress Reporting
26.4.1. ANALYZE Progress Reporting
26.4.2. CREATE INDEX Progress Reporting
26.4.3. VACUUM Progress Reporting
26.4.4. CLUSTER Progress Reporting
26.4.5. Base Backup Progress Reporting

A database administrator frequently wonders, What is the system doing right now? This chapter discusses how to find that out.

Several tools are available for monitoring database activity and analyzing performance. Most of this chapter is devoted to describing LightDB's statistics collector, but one should not neglect regular Unix monitoring programs such as ps, top, iostat, and vmstat. Also, once one has identified a poorly-performing query, further investigation might be needed using LightDB's EXPLAIN command. Section 15.1 discusses EXPLAIN and other methods for understanding the behavior of an individual query.