Book Image

PostgreSQL Administration Essentials

Book Image

PostgreSQL Administration Essentials

Overview of this book

Table of Contents (14 chapters)

Understanding the system statistics of PostgreSQL


There are several system tables and system views to check out PostgreSQL statistics. In this chapter, the most important system views will be covered and discussed. Unfortunately, there is not enough room to cover all those views in detail. However, the most important ones are here.

Tip

More information about those system tables can be found at http://www.postgresql.org/docs/9.4/static/monitoring-stats.html.

Checking out the pg_stat_activity file

The pg_stat_activity file is usually the first thing a system administrator will check out in case something seems to go south. The idea behind pg_stat_activity is to provide the administrator with an overview of all currently open connections on the server. So, you will get one line per database connection. Here is an example of my pg_stat_activity view:

test=# \x
Expanded display (expanded) is on.
test=# SELECT * FROM pg_stat_activity;
-[ RECORD 1 ]----+--------------------------------
 datid     ...