Pcornel
Databases

PostgreSQL

Cheat sheet · https://pcornel.dk/topic.php?topic=6091

Back to the Topic

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; — sessions
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -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

BoundaryInspectHealthy interpretationDo not infer
IntentServer/cluster architectureIntended object/scope is explicit and versioned where relevantIntent is already effective
Owning runtime/control planeRoles and databases / WALOwner accepts and reports the expected object stateDownstream dependencies are healthy
Effective stateVACUUM / autovacuumIndependent read-back matches the intended stateEvery client sees the same result
Consumer outcomeConfiguration and logsThe original bounded check succeeds in the same time windowProduction 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

Confirmation

Confirm action

Continue?