Checking live traffic

Whenever I inspect a system, there is a system view I prefer to inspect first before digging deeper. I am, of course, talking about pg_stat_activity. The idea behind this view is to give you a chance to figure out what is going on right now.

Here is how it works:

test=# \d pg_stat_activity  View "pg_catalog.pg_stat_activity" Column           |           Type           | Collation | Nullable | Default ------------------+--------------------------+-----------+----------+--------- datid            | oid                      |           |          |  datname          | name                     |           |          |  pid              | integer                  |           |          |  usesysid         | oid                      |           |          |  usename          | name                     |           |          |  application_name | text                     |           |          |  client_addr      | inet                     |           |          |  client_hostname  | text                     |           |          |  client_port      | integer                  |           |          |  backend_start    | timestamp with time zone |           |          |  xact_start ...

Get Mastering PostgreSQL 11 - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.