O'Reilly logo

Mastering PostgreSQL 10 by Hans-Jurgen Schonig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inspecting databases

Once you have inspected active database connections, you can dig deeper and inspect database-level statistics. pg_stat_database will return one line per database inside your PostgreSQL instance.

This is what you can find there:

test=# \d pg_stat_database                     View "pg_catalog.pg_stat_database"Column          |       Type               | Collation | Nullable | Default ----------------+--------------------------+-----------+----------+--------- datid          | oid                      |           |         datname        | name                     |           |     numbackends    | integer                  |           |   xact_commit    | bigint                   |           |   xact_rollback  | bigint                   |           |   blks_read      | bigint                   |           |   blks_hit       | bigint                   |           |  tup_returned   | bigint                   |           |   tup_fetched    | bigint                   |           |  tup_inserted   | bigint                   |           |  tup_updated    | bigint                   |           |   tup_deleted    | bigint                   |           |  conflicts | bigint ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required