CertGrid CertGrid
Hands-on Lab·PostgreSQL

PostgreSQL Statistics Views

Cache hit ratio, sequential scans, dead tuples and unused indexes - and a reset that left the table reporting zero rows while holding four hundred thousand.

Monitoring and Operations Guide 41 of 47 Intermediate

Written against the versions above. Since PostgreSQL 15 these counters live in shared memory rather than in a separate collector process, and survive a clean shutdown. `stats_fetch_consistency` controls how they behave inside a transaction.

Every command on this page ran on db-a01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB

Before you start

  1. The whole-database counters

  2. How each table is being read

  3. Find the indexes earning nothing

  4. Block-level I/O per table

  5. Watch a counter move

  6. Reset the counters, and find out what a reset does not touch

Official sources