PostgreSQL: admin cheat sheet (rows per table, sizes, sessions, read-only user)

Exact per-table count with the xpath trick, estimate with pg_stat_user_tables, pg_size_pretty for sizes, pg_terminate_backend or DROP DATABASE WITH (FORCE) for sessions, and GRANT pg_read_all_data for the reporting user.

September 26, 2026 · 4 min