Checking live traffic

Whenever I inspect a system, there is a system view I like to inspect first before digging deeper. I am, of course, talking about pg_stat_activity. The idea behind the 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 |... ------------------+--------------------------+-... 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 | timestamp with time zone | ... query_start | timestamp with ...

Get Mastering PostgreSQL 10 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.