Skip to main content
RunBook Academy

storage · operating-system · automation

PostgreSQL for Production Sysadmins

A production-focused course for the engineers who are paged when a database stops, slows, fills its disk or fails to come back. It covers the PostgreSQL process and memory architecture, installation and configuration as an operator sees them, connections and pooling, authentication and least-privilege roles, storage and the page model, MVCC and transaction visibility, VACUUM and autovacuum and transaction ID wraparound, locks and deadlocks and blocked deployments, query plans and index maintenance at diagnostic depth, the memory parameters that cause outages when guessed, write-ahead logging and checkpoints and crash recovery, backup and WAL archiving and point-in-time recovery performed rather than described, streaming replication and replication slots and lag that means four different things, failover and fencing and split-brain, observability and actionable alerting, capacity planning and maintenance and major version upgrades, PostgreSQL in containers and on Kubernetes and on distributed storage, data corruption response, and a production capstone with twelve injected incidents.

Who this is for

  • Systems administrators who have inherited responsibility for a production database
  • Infrastructure engineers running PostgreSQL on their own hardware or cloud instances
  • Database infrastructure engineers moving from installation to operation
  • Platform engineers designing durable, recoverable data services
  • DevOps engineers who deploy schema changes and need to know what they lock
  • SREs on call for database availability, replication lag and disk capacity
  • Cloud engineers reasoning about what a managed PostgreSQL service still leaves them

Prerequisites

  • Comfortable on a Linux command line
  • Understand filesystems, processes and memory at administrator level
  • Able to read basic SQL; no application development experience required
  • Access to a disposable Linux host or container runtime for the labs

Other RunBook Academy courses

  • Linux — required. PostgreSQL performance and failure are usually Linux performance and failure seen through a database. Storage latency, page cache, cgroup memory limits, the OOM killer, systemd units and filesystem behaviour are all load-bearing here, and the Linux course supplies that depth.
  • Docker & Containers — recommended. Every lab in this course runs against disposable PostgreSQL containers, and the course reasons explicitly about what containerisation does and does not solve for a stateful database.
  • Observability — recommended. The monitoring and alerting material builds on the metric, dashboard and alert-quality patterns taught in the Observability course rather than restating them.
  • Secrets, PKI & Certificates — recommended. PostgreSQL TLS, certificate expiry on a database listener and credential rotation without downtime are covered here from the database side; the Secrets and PKI course owns the certificate and secret-management side.
  • Ceph — recommended. The distributed-storage material reasons about fsync semantics, latency and failure domains beneath a database. The Ceph course owns the storage platform itself.
  • Kubernetes — recommended. Running PostgreSQL on Kubernetes brings StatefulSets, persistent volumes, anti-affinity and fencing into scope. The Kubernetes course owns those mechanics.

What you'll be able to do

After completing this course, you should be capable of independently:

  • Explain the PostgreSQL process and memory architecture, and what each background process costs
  • Distinguish a PostgreSQL database cluster from a high-availability cluster, and use the terms precisely
  • Read effective configuration from a running server and prove whether a change needs a reload or a restart
  • Design pg_hba.conf deliberately, knowing that the first matching rule decides the outcome
  • Operate least-privilege roles and explain the blast radius of superuser access
  • Explain MVCC, tuple visibility and why old row versions persist
  • Diagnose why autovacuum is not keeping up, and act without disabling it
  • Recognise transaction ID wraparound risk before it becomes an emergency
  • Identify the blocking session behind a stalled deployment and decide whether terminating it is safe
  • Read an execution plan and distinguish an SQL problem from a PostgreSQL, storage, memory or network problem
  • Reason about shared_buffers, work_mem and max_connections from measurement rather than folklore
  • Explain write-ahead logging, checkpoints and crash recovery, and what retains WAL
  • Diagnose a growing pg_wal directory without deleting anything
  • Take logical and physical backups and state exactly what each one can and cannot restore
  • Configure WAL archiving and perform a point-in-time recovery to a chosen target
  • Prove a backup is restorable rather than reporting that it completed
  • Build a streaming replica and measure replication lag in the four places it exists
  • Explain how an abandoned replication slot fills a filesystem, and remove one safely
  • Promote a replica, validate the failover, and rejoin or rebuild the former primary
  • Explain split-brain and why fencing is a requirement rather than a refinement
  • Distinguish high availability from backup from disaster recovery, and map each to RPO and RTO
  • Instrument PostgreSQL with signals that are actionable and alerts that are not noise
  • Plan capacity for data, indexes, WAL, temporary files, backups and maintenance headroom
  • Perform minor and major version upgrades with rehearsal, validation and a rollback plan
  • State what a managed PostgreSQL service still leaves you responsible for
  • Respond to suspected data corruption without making it permanent

Curriculum overview

24 planned parts · 127 lessons currently published.

Part I

Architecture and the Process Model

What a PostgreSQL database cluster is and is not, the one-process-per-connection model, shared memory, the background processes, and the first three instruments an operator reaches for.

7 lessons

Part II

Installation, Packaging and Service Management

Choosing a version against the support calendar, distribution versus upstream packaging, what initdb commits you to permanently, service management across distributions, and multiple clusters on one host.

6 lessons

Part III

Configuration Architecture

The configuration file hierarchy and precedence, settings contexts, proving whether a change needs a reload or a restart, inspecting effective configuration, and the failure modes of ALTER SYSTEM.

6 lessons

Part IV

Connections, Sessions and Pooling

What a connection costs, what max_connections actually reserves, reading pg_stat_activity as an instrument, idle in transaction, connection exhaustion, and what transaction pooling breaks.

7 lessons

Part V

Authentication, Roles and TLS

pg_hba.conf as first-match-wins policy, what each authentication method proves, SCRAM and the MD5 deprecation, the sslmode ladder, role membership and ownership, and superuser blast radius.

7 lessons

Part VI

Storage, Pages and TOAST

The durability chain from COMMIT to platter, relations and forks and segments, the 8 KiB page, free space and visibility maps, TOAST, and how to reason about a storage platform without declaring a winner.

6 lessons

Part VII

MVCC, Transactions and Visibility

Why PostgreSQL keeps old row versions, what UPDATE really does to a page, transaction IDs and snapshots, isolation levels as PostgreSQL implements them, and long-running transactions as an operational hazard.

6 lessons

Part VIII

VACUUM, Autovacuum and Wraparound

What VACUUM reclaims and what it does not, autovacuum thresholds and workers, tuning from evidence, the failure modes behind "autovacuum cannot keep up", transaction ID wraparound, bloat measurement, and ANALYZE.

7 lessons

Part IX

Locks, Blocking and Deadlocks

The lock conflict matrix that decides everything, row versus table locks, finding the blocker with pg_locks and pg_blocking_pids, deadlock detection and evidence, the DDL lock queue, and whether killing a session is safe.

6 lessons

Part X

Query Planning, Indexes and Performance Method

How the planner chooses, reading a plan, the safety boundary of EXPLAIN ANALYZE, estimates that go wrong, B-tree maintenance cost, index bloat and REINDEX CONCURRENTLY, and a methodology that starts with evidence.

8 lessons

Part XI

Memory and Resource Management

The shared versus per-backend memory map, shared_buffers against the page cache, the work_mem trap, maintenance_work_mem, temporary file spilling, and Linux memory pressure with cgroups and the OOM killer.

6 lessons

Part XII

WAL, Checkpoints and Crash Recovery

The write-ahead logging durability contract, segments and LSNs and generation rate, what retains WAL and what releases it, checkpoint cost, crash recovery, and why an immediate shutdown changes what happens next.

7 lessons

Part XIII

Backup, Archiving and Point-in-Time Recovery

Backup success is not recovery capability: logical and physical backups and their real limits, WAL archiving and archive integrity, point-in-time recovery performed against a chosen target, and proving a restore rather than reporting one.

8 lessons

Part XIV

Replication, Slots and Read Replicas

Streaming replication end to end, WAL sender and receiver, building a standby, the four distinct meanings of replication lag, the synchronous trade-off, replication slots and unbounded WAL retention, and what a read replica asks of the application.

8 lessons

Part XV

High Availability, Failover and Disaster Recovery

Why replication alone is not high availability, promotion and timelines, split-brain and fencing, what an HA stack must supply beyond PostgreSQL, client routing, validating a failover, rejoining a former primary, and mapping RPO and RTO to real numbers.

8 lessons

Part XVI

Observability, Logging and Alerting

Production logging and what statement logging exposes, the statistics views that matter and the ones that changed between releases, wait events, pg_stat_statements, correlating database evidence with the operating system, and alerts worth waking someone for.

7 lessons

Part XVII

Capacity, Maintenance and Upgrades

Planning capacity for far more than the current database size, telling five kinds of disk-full apart, the resource cost of planned maintenance, schema change as an operations problem, minor upgrades, the major upgrade options compared, pg_upgrade, and rehearsal.

8 lessons

Part XVIII

Platforms, Corruption and Production Architecture

What a managed service still leaves you, what a container does not solve for a stateful database, PostgreSQL on Kubernetes and on distributed storage, corruption signals and careful response, checksums, and a defensible reference architecture.

8 lessons

Part Labs

Labs

Disposable-container labs covering installation, configuration, authentication and TLS, locking and deadlocks, MVCC and autovacuum, plans and statistics, WAL and checkpoints, backup and point-in-time recovery, replication and promotion, pooling, and a major version upgrade rehearsal.

0 lessons

Part Runbooks

Runbooks

Operational procedures for a database that will not start, connection and authentication failures, blocking sessions and deadlocks, autovacuum and transaction age, disk-full and WAL growth, archive failure, replication lag and failed replicas, safe promotion, backup and restore, point-in-time recovery, upgrades and disaster recovery.

0 lessons

Part Checklists

Checklists

Production readiness reviews for deployment, security hardening, storage, connections and pooling, backup and point-in-time recovery, replication, high availability, monitoring and alerting, capacity, planned maintenance, upgrades, and disaster recovery.

0 lessons

Part Breakfix

Break/Fix Scenarios

Evidence-first diagnosis of startup, access, transaction, vacuum, lock, planner, WAL, archiving, replication, failover, backup, recovery, resource and corruption failures, each reproduced against a real PostgreSQL instance.

0 lessons

Part Capstone

Production Capstone

Build and defend a complete production PostgreSQL architecture: secure deployment, controlled connections, monitored durability, a proven point-in-time recovery, a streaming replica, a validated failover, and twelve injected incidents to survive.

1 lesson

Part Final

Final Assessment

Final theory assessment plus a final practical assessment of an inherited estate carrying realistic availability, durability, capacity, performance and security defects.

0 lessons

Verified against

  • PostgreSQLv18.x· released 2026-08-13· verified 2026-08-27
  • PostgreSQL (comparison targets)v17.11, 16.15· verified 2026-08-27
  • PostgreSQL (support calendar)v18, 17, 16, 15, 14 supported· verified 2026-08-27
  • pgBackRestv2.59.1· released 2026-08-17· verified 2026-08-27
  • PgBouncerv1.25.2· released 2026-05-08· verified 2026-08-27
  • Patroniv4.1.5· released 2026-08-12· verified 2026-08-27
  • Ubuntu (host baseline)v26.04 LTS· verified 2026-08-27