Inspecting tables

Once you have gained an overview of what is going on in your databases, it might be a good idea to dig deeper and see what is going on in individual tables. Two system views are here to help you: pg_stat_user_tables and pg_statio_user_tables. Here is the first one:

test=# \d pg_stat_user_tables View "pg_catalog.pg_stat_user_tables" Column | Type | ... ---------------------+--------------------------+-... relid | oid | ... schemaname | name |... relname | name |... seq_scan | bigint |... seq_tup_read | bigint |... idx_scan | bigint |... idx_tup_fetch | bigint |... n_tup_ins | bigint |... n_tup_upd | bigint |... n_tup_del | bigint |... n_tup_hot_upd | bigint |... n_live_tup | bigint |... n_dead_tup | bigint |... n_mod_since_analyze ...

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.