psql -d appdb -c "SELECT * FROM pg_stat_database WHERE datname = 'appdb';"

Category: Databases & SQL

psql -d appdb -c "SELECT * FROM pg_stat_database WHERE datname = 'appdb';"

Show per-database activity counters

Reports commits, rollbacks, cache hit ratio, deadlocks, and XID age for one database. A low blks_hit ratio hints at a small shared_buffers. The main dashboard table for capacity work.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.