PostgreSQL · Curriculum
Curriculum
127 lessons across 24 parts. Lessons build on each other; later parts assume familiarity with earlier material.
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.
- 01What a PostgreSQL "database cluster" actually isArchitecture · foundation · ~25 min
- 02The process model: one backend per connectionArchitecture · foundation · ~25 min
- 03Shared memory and the buffer poolArchitecture · intermediate · ~25 min
- 04The background processes and what each one is responsible forArchitecture · intermediate · ~25 min
- 05A connection from TCP to first queryArchitecture · intermediate · ~25 min
- 06Inside the data directoryArchitecture · intermediate · ~25 min
- 07The operator's first instrumentsArchitecture · intermediate · ~30 minLab
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.
- 01Choosing a version, and the support calendar that decides itInstallation · foundation · ~20 min
- 02Packaging, and where the packaging decides things liveInstallation · intermediate · ~25 minLab
- 03What initdb commits you to, permanentlyInstallation · intermediate · ~25 min
- 04Service management, and stopping PostgreSQL safelyInstallation · intermediate · ~25 min
- 05Multiple clusters on one hostInstallation · intermediate · ~25 min
- 06PostgreSQL in a container imageInstallation · intermediate · ~25 min
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.
- 01Where configuration comes fromConfiguration · intermediate · ~25 min
- 02Settings contexts, and planning a change from themConfiguration · intermediate · ~25 min
- 03The precedence ladder beyond the filesConfiguration · intermediate · ~25 minLab
- 04ALTER SYSTEM, and how it failsConfiguration · advanced · ~25 min
- 05Proving a change took effectConfiguration · intermediate · ~25 min
- 06A configuration you can hand overConfiguration · intermediate · ~25 min
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.
- 01What a connection costsConnections · intermediate · ~25 min
- 02max_connections, and what it actually reservesConnections · intermediate · ~25 min
- 03Reading pg_stat_activity as an instrumentConnections · intermediate · ~25 minLab
- 04Idle in transaction, and what it actually holdsConnections · advanced · ~30 min
- 05Connection exhaustion and the storm that followsConnections · advanced · ~25 min
- 06Why pooling exists, and the three modesConnections · intermediate · ~25 min
- 07PgBouncer in productionConnections · advanced · ~25 minLab
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.
- 01pg_hba.conf: first match winsAuthentication · intermediate · ~30 minLab
- 02Authentication methods and what each one provesAuthentication · intermediate · ~25 min
- 03SCRAM, password storage, and the MD5 deprecationAuthentication · intermediate · ~25 min
- 04TLS and the sslmode ladderAuthentication · intermediate · ~30 minLab
- 05Roles, membership and inheritanceAuthorisation · intermediate · ~25 min
- 06Ownership, default privileges, and the permission disaster they causeAuthorisation · intermediate · ~25 min
- 07Superuser, and what it really grantsAuthorisation · advanced · ~25 min
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.
- 01The durability chain from COMMIT to platterStorage · advanced · ~25 min
- 02Relations, forks and segmentsStorage · intermediate · ~25 min
- 03Pages and tuplesStorage · advanced · ~30 min
- 04The free space map and the visibility mapStorage · intermediate · ~30 min
- 05TOAST and large valuesStorage · intermediate · ~30 min
- 06Choosing storageStorage · advanced · ~30 min
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.
- 01Why PostgreSQL keeps old row versionsMVCC · intermediate · ~25 min
- 02What UPDATE actually does to a pageMVCC · advanced · ~30 minLab
- 03Transaction IDs, snapshots and tuple visibilityMVCC · advanced · ~30 min
- 04Isolation levels as PostgreSQL implements themMVCC · advanced · ~35 min
- 05Long-running transactionsMVCC · intermediate · ~30 min
- 06Reading transaction ageMVCC · intermediate · ~25 min
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.
- 01What VACUUM doesVacuum · intermediate · ~30 min
- 02Autovacuum: launcher, workers and thresholdsVacuum · intermediate · ~30 minLab
- 03Tuning autovacuum from evidenceVacuum · advanced · ~35 min
- 04When autovacuum cannot keep up: six failure modesVacuum · advanced · ~35 min
- 05Transaction ID wraparound and anti-wraparound vacuumVacuum · advanced · ~35 min
- 06Measuring bloat honestlyVacuum · advanced · ~30 minLab
- 07ANALYZE and planner statisticsVacuum · intermediate · ~30 min
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.
- 01Lock modes and the conflict matrixLocks · intermediate · ~30 min
- 02Row locks versus table locksLocks · advanced · ~30 min
- 03Finding the blockerLocks · intermediate · ~30 minLab
- 04DeadlocksLocks · intermediate · ~30 minLab
- 05DDL and the lock queueLocks · advanced · ~35 min
- 06Cancel or terminateLocks · intermediate · ~30 min
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.
- 01How the planner choosesPlanner · intermediate · ~30 min
- 02Reading an EXPLAIN planPlanner · intermediate · ~30 minLab
- 03EXPLAIN ANALYZE and its safety boundaryPlanner · intermediate · ~25 min
- 04When estimates go wrongPlanner · advanced · ~35 minLab
- 05B-tree indexes and what they costPlanner · intermediate · ~30 min
- 06Beyond B-tree, where it mattersPlanner · advanced · ~30 min
- 07Index maintenancePlanner · intermediate · ~30 min
- 08A performance methodologyPlanner · advanced · ~30 min
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.
- 01PostgreSQL's memory mapMemory · intermediate · ~30 min
- 02shared_buffers and the OS page cacheMemory · intermediate · ~30 min
- 03The work_mem trapMemory · advanced · ~30 minLab
- 04maintenance_work_mem and the operations that use itMemory · intermediate · ~25 min
- 05Temporary files and spilling to diskMemory · intermediate · ~25 min
- 06Linux memory pressure and the OOM killerMemory · advanced · ~30 min
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.
- 01Write-ahead logging: the durability contractWAL · intermediate · ~30 min
- 02WAL segments, LSNs and generation rateWAL · intermediate · ~25 minLab
- 03What retains WAL, and what releases itWAL · advanced · ~30 min
- 04Checkpoints: what they do and what they costWAL · advanced · ~30 minLab
- 05Background writing and the PostgreSQL 18 I/O subsystemWAL · advanced · ~30 min
- 06Crash recovery: what "consistent state" meansWAL · intermediate · ~30 min
- 07Shutdown modes and their recovery consequencesWAL · intermediate · ~25 min
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.
- 01Backup success is not recovery capabilityBackup · intermediate · ~30 min
- 02Logical backups: pg_dump, pg_restore, scope and limitsBackup · intermediate · ~30 minLab
- 03Physical backups and the low-level APIBackup · advanced · ~30 min
- 04pg_basebackup: its role and its limitsBackup · intermediate · ~35 minLab
- 05WAL archiving: archive_command, integrity, retentionBackup · advanced · ~35 minLab
- 06Point-in-time recovery, performedBackup · advanced · ~40 minLab
- 07Recovery targets and the action taken on reaching oneBackup · advanced · ~30 min
- 08Backup tooling, restore testing, and proving recoverabilityBackup · intermediate · ~30 minLab
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.
- 01Physical streaming replication end to endReplication · intermediate · ~30 min
- 02WAL sender and WAL receiverReplication · intermediate · ~25 min
- 03Building a standbyReplication · intermediate · ~30 minLab
- 04Measuring lag properly: sent, written, flushed, replayedReplication · intermediate · ~30 minLab
- 05Synchronous replication and the trade-off it makesReplication · advanced · ~35 min
- 06Replication slots and unbounded WAL retentionReplication · advanced · ~30 minLab
- 07Replica conflicts and hot_standby_feedbackReplication · advanced · ~35 minLab
- 08Read replicas and what the application must acceptReplication · intermediate · ~30 min
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.
- 01Replication is not high availabilityHA · intermediate · ~30 min
- 02Promotion, timelines, and what a timeline switch meansHA · advanced · ~30 minLab
- 03Split-brain and why fencing is not optionalHA · advanced · ~35 min
- 04What an HA stack must supply beyond PostgreSQLHA · intermediate · ~30 min
- 05Patroni as one implementation — concepts firstHA · advanced · ~30 min
- 06Client routing: DNS, VIP, proxy, service discoveryHA · intermediate · ~30 min
- 07Validating a failover, and rejoining a failed primary with pg_rewindHA · advanced · ~35 minLab
- 08HA versus backup versus DR; RPO and RTO with real arithmeticHA · intermediate · ~30 min
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.
- 01Production logging configurationObservability · intermediate · ~30 min
- 02Log security: what statement logging exposesObservability · intermediate · ~25 min
- 03The statistics views that matter, and the ones that changedObservability · intermediate · ~30 min
- 04Wait events: what is this backend actually waiting on?Observability · advanced · ~30 min
- 05pg_stat_statementsObservability · intermediate · ~30 minLab
- 06Correlating PostgreSQL evidence with the operating systemObservability · intermediate · ~30 min
- 07Alerting that is actionableObservability · intermediate · ~30 min
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.
- 01Capacity planning beyond current database sizeMaintenance · intermediate · ~30 min
- 02Disk-full: distinguishing data, WAL, temp, archive and backupMaintenance · advanced · ~35 minLab
- 03Planned maintenance and its resource costMaintenance · intermediate · ~30 min
- 04DDL and schema change from an operations perspectiveMaintenance · advanced · ~35 min
- 05Minor version upgradesMaintenance · foundation · ~25 min
- 06Major version upgrade options comparedMaintenance · intermediate · ~30 min
- 07pg_upgrade in practiceMaintenance · advanced · ~35 minLab
- 08Upgrade rehearsal and post-upgrade validationMaintenance · intermediate · ~30 minLab
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.
- 01Managed versus self-managed: what stays your responsibilityPlatforms · intermediate · ~30 min
- 02PostgreSQL in containers: what a container does not solvePlatforms · intermediate · ~30 min
- 03PostgreSQL on Kubernetes: operators, StatefulSets, storage, fencingPlatforms · advanced · ~30 min
- 04PostgreSQL on distributed storagePlatforms · advanced · ~30 min
- 05Data corruption: signals and careful responsePlatforms · advanced · ~35 minLab
- 06Checksums, index corruption, and storage failurePlatforms · advanced · ~30 minLab
- 07Automating PostgreSQL, and change management for database changePlatforms · intermediate · ~30 min
- 08A production reference architecturePlatforms · advanced · ~35 min
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.
No lessons published in this part yet. The full curriculum is planned in docs/courses/postgresql/curriculum.md on GitHub.
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.
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.
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.
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.
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.
No lessons published in this part yet. The full curriculum is planned in docs/courses/postgresql/curriculum.md on GitHub.