Chapter 25. Monitoring Database Activity

Table of Contents
25.1. Standard Unix Tools
25.2. The Statistics Collector
25.2.1. Statistics Collection Configuration
25.2.2. Viewing Collected Statistics
25.3. Viewing Locks
25.4. Dynamic Tracing
25.4.1. Compiling for Dynamic Tracing
25.4.2. Built-in Trace Points
25.4.3. Using Trace Points
25.4.4. Defining Trace Points

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 PostgreSQL '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 may be needed using PostgreSQL 's EXPLAIN command. Section 13.1 discusses EXPLAIN and other methods for understanding the behavior of an individual query.