PostgreSQL
Cheat sheet · https://pcornel.dk/topic.php?topic=6091
Answer
PostgreSQL is an open-source relational database with MVCC, WAL, rich types and extensions, configured in postgresql.conf and pg_hba.conf and managed with psql.
Remember
Watch connections (use a pooler), autovacuum, WAL/disk, and pg_hba.conf for access. pg_stat_statements shows the heaviest queries.
First checks
SELECT * FROM pg_stat_activity;— sessionspsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -S <server> -Q "SELECT @@VERSION"— SQL Server reachable and version
Verify in this order
client → pg_hba auth → backend process → shared buffers/WAL → data files
Where it usually breaks
Frequent failures include pg_hba/authentication mismatches, WAL retention filling disks, long transactions preventing vacuum cleanup, autovacuum lag, replication slots retaining WAL and assuming pg_dump is equivalent to a physical/PITR-capable backup.
PostgreSQL verification boundary matrix
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | Server/cluster architecture | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | Roles and databases / WAL | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | VACUUM / autovacuum | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | Configuration and logs | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6091