A real PostgreSQL primary and replica run on your laptop. The lab breaks them the way production breaks. You get the alert, a terminal and three hints, and a check that grades your fix against the live database. No answers in the box: the task and the grading come from this site, for your session only.
One command with your personal key. It writes a small Docker Compose file and a lab script, marked with your name. The kit is an empty cluster: no tasks, no answers.
./lab start replica-lag asks this site for a new session. The site picks one of several causes, breaks your cluster to match, and starts a steady write load. Every session can be different.
Use ./lab psql primary and ./lab psql replica like on call. Stuck? ./lab hint 1, 2, 3, from a nudge to the place to look.
./lab check reads a few numbers from your cluster and sends them here. The site decides pass or fail and tells you what is still wrong, without giving the answer away.
| Lab | The alert | What you practice |
|---|---|---|
replica-lag | Replica lag on orders-db has been rising for 10 minutes. Reads from the replica show stale data. | Reading pg_stat_replication, telling receive lag from replay lag, and finding what stops replay on the replica. Read Replication first if the terms are new. |
patroni-failover | Writes to orders-db fail on a three-node Patroni cluster. | Reading patronictl list and the Patroni logs, and finding why the leader stopped taking writes and why no other member was promoted. Read PostgreSQL high availability with Patroni first. |
connection-storm | The orders app is timing out behind PgBouncer. Nothing was deployed today. | Telling apart a database out of connection slots, connections stuck waiting on a lock, and a pooler that will not hand them out, with pg_stat_activity, pg_blocking_pids and PgBouncer's SHOW POOLS. Read the connection limit section of the AI agents guide for PgBouncer basics. |
innodb-member | The orders InnoDB Cluster runs with 2 of 3 members. One more failure and it stops. | Reading cluster.status() in MySQL Shell and the error log, finding why a member left and why it did not come back, and choosing between a rejoin and a clone. Read InnoDB Cluster first. |
mongo-no-primary | Every write to the shop database fails with "not primary". Reads from secondaries still work. | Reading rs.status() and rs.conf(), and working out whether the replica set lacks a majority or lacks a member that is allowed to win. Read replica sets first. |
# install the kit (replace KEY with yours) curl -fsS -H "Authorization: Bearer KEY" https://howdatabaseswork.com/api/lab/kit | bash cd howdbswork-lab ./lab login KEY ./lab start replica-lag ./lab psql replica # investigate ./lab hint 1 # if you are stuck ./lab check # graded on the site ./lab reset # remove the cluster and its data
./lab check sends: how many replicas the primary sees, the replay gap in bytes, whether replay is paused, two replica settings (recovery_min_apply_delay, max_standby_streaming_delay), and how many transactions on the replica are older than 10 seconds. No data from your tables, no host names. The site logs your key id, the lab, and pass or fail. The cluster runs only on your machine and holds only lab data.
Can I see it happen? Simulations, an index you build yourself, a real PostgreSQL in your browser, experiments run on real servers, and tools for your own database: a query coach, an EXPLAIN reader, a config checker and a health check.