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

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 ...

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