Sub topic 15
Dashboard and Statistics tabs
This chapter assumes you know basic SQL, can connect to PostgreSQL with pgAdmin 4, and understand tables, sessions, and indexes. The Dashboard and Statistics tabs help you inspect a running database without writing every monitoring query yourself.
Open the monitoring views
In pgAdmin, expand the registered server, then expand the database you want to inspect. Select the database and open its Dashboard tab. The dashboard displays a current overview of activity. It usually includes server sessions, transactions per second, tuples processed, blocks read, and server activity.
Charts are useful for spotting changes over time. A sudden increase in active sessions may indicate a traffic spike. A rise in blocked sessions may indicate lock contention. High disk reads can mean that queries are reading data from storage instead of finding it in shared buffers.
The dashboard is a snapshot that refreshes periodically. Use the refresh control when you need current values. The displayed history is limited, so use a dedicated monitoring system for long-term trends.
Read the Statistics tab
The Statistics tab appears for objects such as databases, tables, and indexes. It reports counters collected by PostgreSQL statistics views. The exact fields depend on the selected object and PostgreSQL version.
For a database, inspect values such as committed transactions, rolled-back transactions, blocks read, blocks hit, and active backends. A high rollback count can show failed application work. A low cache-hit ratio may suggest that queries need more disk reads, although a single reading is not enough to diagnose a problem.
For a table, look at sequential scans, index scans, inserted rows, updated rows, deleted rows, and live or dead rows. A table with many sequential scans is not automatically unhealthy. Sequential scans can be efficient for small tables or queries that return a large part of a table.
| Observation | Possible meaning | Next check |
|---|---|---|
| Many dead rows | Updates or deletes have left old row versions | Check autovacuum and table vacuum statistics |
| Many sequential scans | Queries often scan the whole table | Inspect query filters and table size |
| Many rolled-back transactions | Work frequently fails or is canceled | Check application errors and lock waits |
Statistics are cumulative counters. They generally describe activity since the last statistics reset or server restart, not only the last few minutes. Compare values at two points in time to calculate a rate.
Investigate carefully
Use the dashboard to find a signal, then use the Statistics tab and Query Tool to narrow the cause. For example, if active sessions rise, inspect current sessions and wait events before terminating anything. A session may be waiting normally, and ending it can roll back an active transaction.
The account viewing statistics also needs suitable privileges. Some session details are hidden from ordinary users. A database administrator may see more information than an application role.
Exercise
The Dashboard shows many active sessions, but the Statistics tab shows no unusual table activity. What should you check next?
Show answer
Check whether the sessions are waiting on locks, idle in a transaction, or connected but doing no work. Then inspect wait events and application behavior before concluding that the database is overloaded.