Database wide totals

Many of the same pieces of data available at the table level are also summarized per database. You can get the following information out of pg_stat_database and use it in similar ways to pg_stat_user_tables and pg_statio_user_tables:

SELECT datname,blks_read,blks_hit,tup_returned,tup_fetched,tup_inserted ,tup_updated,tup_deleted FROM pg_stat_database;

In addition, there are some useful transaction commit statistics available, as well as a count of the total active client backend connections active for each database:

SELECT datname,numbackends,xact_commit,xact_rollback from pg_stat_database;

Get PostgreSQL 9.0 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.