Topic
PostgreSQL DBA
Run PostgreSQL the way a database administrator does: install, query, secure, tune, back up, pool, upgrade and keep it highly available.
- 13 hands-on labs
- Beginner to advanced
- DevOps plan
Opens with the DevOps plan. Cloud, AI, Data and Teams include it too.
Labs
13 labs in order. Beginner to advanced.
Each lab is a real machine built only for you, with a guide and checks that read what you actually did.
- Beginner
Your first PostgreSQL server
Install PostgreSQL 16, give a program its own role and database, connect with a password file, create tables whose constraints protect the data, and load and export CSV files.
- Beginner
Ask a shop questions in SQL
Answer a shop's questions in SQL and save each answer as a view: joins and an anti join, a correlated subquery, a recursive category tree, window functions and LATERAL.
- Intermediate
From a spreadsheet to a schema
Turn a flat spreadsheet into a normalized schema with keys and domains, keep a history of price changes with a trigger, write a PL/pgSQL function and partition a large table by month.
- Intermediate
Roles, rows and the network door
Secure a multi tenant database: group and login roles with least privilege and default privileges, a schema for analysts, row level security per tenant, and connections only over TLS with SCRAM.
- Intermediate
Tune the server for its VM
Find where every setting comes from, size memory for the VM with ALTER SYSTEM, give one role and one database their own settings, spread checkpoints out, log slow queries, and prove the change with pgbench before and after.
- Intermediate
Slow queries, plans and indexes
Find the shop's most expensive queries with pg_stat_statements, read their plans with EXPLAIN ANALYZE, fix each with the right index, B-tree, GIN or BRIN, and measure the workload before and after.
- Intermediate
Row versions, vacuum and locks
See row versions and isolation levels at work, find the forgotten transaction that holds vacuum back, remove bloat and tune autovacuum for one table, and catch a lock wait and a deadlock.
- Intermediate
Backups and point in time recovery
Back up a database with pg_dump and its roles with pg_dumpall and restore them, archive WAL and take a base backup, then bring the cluster back to the moment before an accidental DROP TABLE.
- Advanced
Pooling and monitoring
Put PgBouncer in transaction mode in front of an application that opens too many connections, turn a sample of the server log into a pgBadger report, and read the four golden signals from a PostgreSQL exporter.
- Advanced
Backups with pgBackRest
Make node-2 a pgBackRest repository for node-1's PostgreSQL: full, differential and incremental backups with retention, a restore after losing the data directory, and a point in time restore.
- Advanced
Upgrade with logical replication
Move a live store from PostgreSQL 16 to 17 with logical replication and a cut over of a few seconds, then upgrade the old server in place with pg_upgrade --check and --link.
- Advanced
High availability with Patroni
Build a three node PostgreSQL cluster with Patroni and etcd behind HAProxy, switch the leader over, survive a frozen leader with an automatic failover, watch pg_rewind bring it back, and use maintenance mode.
- Advanced
The night everything broke
Bring a broken production server back: a change that stops PostgreSQL starting, a runaway report, a forgotten transaction blocking every order, WAL piling up behind an abandoned slot, and a missing index.
Learning paths