2026 07 08 Data Scientist 0110¶
Slice
data-scientist/0110Β· Level 0110 (Database Mastery) Β· Adventurer tier Β· Engine verdict β οΈ warn Β· Walked 2026-07-08π Perfection run Β· π Perfection dashboard Β· π Raw report Β· π Change history
π― Session Summary¶
I walked the Data Scientist path through the tail window of Level 0110 β Database Mastery (βοΈ Adventurer tier): three linked main quests, in planner order Backup & Recovery β Query Optimization β Connection Pooling. This is window 2 of 2 of an 8-quest level (offset 5), so the four foundational quests (database-fundamentals, sql-mastery, data-modeling, database-security) were swept in a prior window and were not re-walked here.
Headline verdict: β οΈ warn. The engine ran each quest's real commands in a disposable sandbox and scored an average of 65.0% (0 pass Β· 2 warn Β· 1 fail). The conceptual teaching across all three is genuinely strong and mostly verified hands-on β pg_dump/pg_restore round-trips, EXPLAIN/index reasoning, and the pool-sizing math all held up under execution. But each quest ships at least one copy-paste-and-it-breaks defect a learner on the recommended "quickest" (Docker) path would hit immediately: an unreachable containerized DB and unwritable /backups path (Backup), a users table the seed script never creates (Query Optimization), and a PgBouncer Docker command + pgbouncer.ini that both fail to start plus a nonexistent psycopg2 API (Connection Pooling β the one fail). These are correctable content bugs, not design flaws; the chain is worth keeping and fixing.
πΊοΈ The Journey¶
| # | Verdict | Quest | Score | One-line takeaway |
|---|---|---|---|---|
| 1 | β οΈ warn | Backup and Recovery: Data Protection for Databases | 70 | Logical backup + restore-drill round-trips ran flawlessly; physical backup (pg_basebackup//backups) and the Docker path are broken as written. |
| 2 | β οΈ warn | Query Optimization: Tuning Fast Database Queries | 73 | EXPLAIN/index/composite-index teaching verified live; the N+1 flagship rewrite references a users table the quest never seeds. |
| 3 | β fail | Connection Pooling: Efficient Database Resource Management | 52 | Concepts sound and pg_stat_activity SQL works, but the "deploy PgBouncer" core (Docker cmd + .ini) and the Chapter 1 Python all fail on execution. |
π¬ Evidence¶
All statuses below come from commands the execute engine actually ran in the sandbox (walk-evidence.json), or are explicitly labelled reasoned where a step was judged statically (e.g. macOS/Windows paths on a Linux sandbox). I did not run any commands myself β I consumed the workflow-sealed evidence and reasoned about the linked journey over the quest sources.
1. Backup and Recovery β 70% (warn) Β· ran 4/7 runnable snippets (1β), 6 reasoned¶
- β
passed Β·
pg_dump -Fc restoration_vault > vault_backup.dump; createdb restored_vault; pg_restore -d restored_vault vault_backup.dumpβ dump created (5314 bytes), restore succeeded,SELECT * FROM treasurereturned the same 3 rows (gold/silver/gems). The Chapter 1 core works end to end. - β
passed Β· Chapter 3 restore-drill script (
createdb drill_$(date +%Y%m%d); pg_restore β¦; psql β¦ "SELECT count(*) FROM treasure;") β produceddrill_20260708with correct row count 3. The flagship "prove your backup" habit is fully runnable. - β
passed Β· Cloud/Docker
docker run --name restoration β¦ postgres:16β container started and DB created (the-itvariant failed only for lack of a TTY in the sandbox, a sandbox artifact, not counted against the quest). - β failed Β·
pg_basebackup -D /backups/base -Ft -z -Pβ fails two ways: hostβcontainer givesFATAL: no pg_hba.conf entry for replication connection from host "172.17.0.1", and locallymkdir /backupsreturns Permission denied for a normal user. Only succeeded after re-running inside the container against the local socket into a writable path. - π§ reasoned Β· macOS/Windows/Linux setup paths (standard, unrunnable on this
sandbox);
postgresql.confWAL config (verifiedwal_level=replicais already the PG16 default viaSHOW); PITR recovery config (syntactically valid but omits the PG12+recovery.signalrequirement).
2. Query Optimization β 73% (warn) Β· ran 5/9 runnable snippets (2β), 2 reasoned, 3 skipped¶
- β
passed Β· Seed script
CREATE TABLE events (β¦); INSERT β¦ generate_series(1,100000); ANALYZE events;βINSERT 0 100000on a local PG 16.14, exact match to expected. - β
passed Β·
EXPLAIN ANALYZE SELECT * FROM events WHERE user_id = 42;(pre-index) β producedSeq Scan β¦ Rows Removed by Filter: 99983 β¦ Execution Time: 5.555 ms, matching the quest's described shape (absolute timing differs from the sample's 49.1 ms, expected hardware variance). - β
passed Β· composite index
CREATE INDEX idx_events_user_action ON events(user_id, action)β verified the composite index servesuser_id + actionanduser_idalone, and thataction-only filtering falls back to Seq Scan, exactly as the quest claims (leftmost-prefix behaviour confirmed). - β failed Β·
CREATE INDEX idx_events_user_id β¦; EXPLAIN ANALYZE β¦ WHERE user_id = 42;β index worked and query got ~40Γ faster (0.131 ms), but PG16 rendered a Bitmap Heap Scan + Bitmap Index Scan, not theIndex Scan using idx_events_user_idthe quest prints as sample output. Concept holds; the literal output does not reproduce. - β failed Β· Chapter 3 N+1 rewrite (JOIN/
INagainstusers) β the embedded SQL references auserstable the quest's own seed script never creates; running it against the built schema fails withERROR: relation "users" does not exist. - π§ reasoned / skipped Β· macOS path (reasoned), Windows + Docker + illustrative EXPLAIN text block (skipped as unrunnable/conflicting-port).
3. Connection Pooling β 52% (fail) Β· ran ⅚ runnable snippets (3β), 3 skipped¶
- β
passed Β· pool-sizing formula
(8*2)+1 = 17β arithmetic verified; matches HikariCP's published guidance. - β
passed Β·
SELECT pid, state, query, state_change FROM pg_stat_activity WHERE datname='gatekeeper' β¦β ran verbatim against a real PG16gatekeeperDB, returned the expected columns. - β failed Β· Cloud Realms
docker run --name pgbouncer β¦ edoburu/pgbouncerβ container exits immediately:DB_HOST: β¦ You must set DB_HOST env(the image wantsDB_HOST/DB_USER/DB_PASSWORD, not theDATABASES_*the quest uses); even after fixing env,-p 6432:6432fails because the image listens on 5432 internally. - β failed Β·
pgbouncer.iniβ loaded verbatim into real PgBouncer 1.25.2:FATAL cannot load config file/invalid value "transaction ; return the connection after each transaction" for parameter pool_mode. PgBouncer does not accept trailing same-line;comments; removing them made it start. - β failed Β· Chapter 1 Python β
conn.execute(query)raisesAttributeError: 'psycopg2.extensions.connection' object has no attribute 'execute'(psycopg2 needs a cursor); andConnectionPool/pool.connection()is psycopg3's API, imported nowhere. - βοΈ skipped Β· macOS/Windows/Linux package-manager setup paths (no sudo/brew/winget
in sandbox; package IDs verified to exist via
apt-cache policy).
π Issues Found¶
Every issue below cites a command that actually ran or an exact line from the quest source. Severity mirrors the engine's own recommendation weighting.
Backup and Recovery
- high Β· Cloud Realms / Docker path (lines 178β188 + all of Chapter 1) β After
docker run/docker exec createdb, every later command (pg_dump, createdb, pg_restore, psql, pg_basebackup) is written as a bare local invocation with no -h/-U/-P or docker exec wrapper. Observed: a Docker-path learner has no way to reach the containerized DB. Fix: wrap subsequent commands in docker exec restoration β¦ or export PGHOST/PGUSER/PGPASSWORD for host-side tools.
- high Β· pg_basebackup path (line 216) β pg_basebackup -D /backups/base β¦.
Observed: mkdir /backups β Permission denied for a normal user. Fix: have the learner mkdir -p ~/pg_backups (a writable path) first, and use it throughout.
- medium Β· pg_basebackup prerequisites β Observed: even against the quest's
own Docker container the physical backup fails with no pg_hba.conf entry for replication connection. Fix: note that pg_basebackup needs a REPLICATION role + a pg_hba.conf replication entry for the client address.
- medium Β· Chapter 2 PITR recovery config (lines 252β256) β Observed (reasoned):
the shown restore_command/recovery_target_time alone won't trigger recovery on the quest's stated PG14+ minimum. Fix: mention the PG12+ recovery.signal file.
- low Β· Objectives vs body (lines 105β106) β "Backup Automation" and "Backup
Encryption" are listed as objectives but taught nowhere. Fix: add a short cron/gpg -c example or drop the claims.
- low Β· No teardown β several scratch DBs + a container are created with no
cleanup step. Fix: add a drop/docker rm -f teardown.
Query Optimization
- high Β· Chapter 3 N+1 + Advanced Challenge (lines 296β311, 342β350) β the rewrite
and the challenge's "returns identical data" validation depend on a users table. Observed: ERROR: relation "users" does not exist against the quest's own schema. Fix: seed a users table (e.g. CREATE TABLE users(user_id INT PRIMARY KEY) with the same 5000 ids), or rewrite the example to query events alone (DISTINCT user_id).
- medium Β· Chapter 2 sample EXPLAIN output (lines 265β267) β printed as
Index Scan using idx_events_user_id. Observed: PG16.14 chose a Bitmap Heap Scan instead. Fix: update the sample or add a caveat that a Bitmap scan is the normal PG16 choice for this selectivity (both mean the index is used).
- medium Β· Objective vs body (line 104) β "Composite & Covering Indexes" is
promised but INCLUDE/index-only scans are never shown. Fix: add a covering-index demo or trim the objective.
- low Β· Knowledge Check questions have no answer key; the accurate LOWER(email)
sargability point (line 278) has no runnable snippet.
Connection Pooling
- high Β· Cloud Realms Docker snippet (lines 183β187) β Observed: container exits
with You must set DB_HOST env; port mapping also wrong. Fix: use DB_HOST/DB_USER/DB_PASSWORD (or DATABASE_URL) and -p 6432:5432 (or add -e LISTEN_PORT=6432). This is the "quickest path" and it is the first thing a learner runs.
- high Β· pgbouncer.ini (lines 274β285) β Observed: PgBouncer 1.25.2 refuses
the file: invalid value "transaction ; β¦" for parameter pool_mode. Fix: move the ; comments to their own lines above each setting.
- medium Β· Chapter 1 Python (lines 203β217) β Observed:
AttributeError: β¦ no attribute 'execute'; ConnectionPool is psycopg3 API. Fix: either label the block pseudocode, or make it runnable (psycopg2 cursor().execute + ThreadedConnectionPool, or switch consistently to psycopg3 ConnectionPool).
- low Β· Advanced "Catch a Leak" challenge gives no concrete leak-inducing sample;
macOS postgresql@16 is keg-only and may need brew link before createdb.
No slice-wide blocking issue prevents a knowledgeable reader from learning the material β every defect is a broken artifact inside an otherwise sound chapter.
π Chain Continuity¶
Reading the three sources in plan order as a single learner journey:
- The spine holds for the developer path, diverges for the Data Scientist. The
"Continue the Main Story" links form a clean chain: Backup β Connection Pooling, Query Optimization β Connection Pooling, and Connection Pooling β Level 0111 (it is the terminal quest,
unlocks_quests: [], completing the level). But every quest's Data Scientist class recommendation points away from this window β Backup and Query Optimization both send the Data Scientist todatabase-migrations(a side quest not in this slice), and Connection Pooling says "Revisit Query Optimization." So a Data Scientist following their own class breadcrumbs would not naturally walk this three-quest order; the planner's dependency-sorted order is the coherent path, and the class recommendations feel bolted on rather than curated for this window. Worth aligning. - Prerequisite gaps are out-of-window, not missing. All three quests require
database-fundamentalsand/orsql-mastery, which live in window 1 of this level and were swept earlier β so the assumed SQL/JOIN/index literacy is satisfied by the level, just not by this slice. A learner dropping straight into this window cold would lack that grounding, but the frontmatter dependencies flag it correctly. - Setup is redundantly re-taught but consistent. Each quest re-presents the full
four-platform (macOS/Windows/Linux/Docker) install block and uses a distinct scratch database (
restoration_vault,speed_sanctum,gatekeeper) β so there is no cross-quest state collision and a learner can start any quest independently. Good isolation; mild repetition. - A recurring Docker-path weakness runs through the whole slice. The same friction β "you started a container, now how do you reach it for the next command" β appears in Backup (never explained) and is outright broken in Connection Pooling (bad env vars/ports). Since Docker is advertised as the "quickest" path in two of the three quests, this is the single highest-leverage fix for the slice's end-user experience: a learner picking the recommended path hits a wall in quest 1 and again in quest 3.
- Conceptual continuity is strong. Query Optimization explicitly motivates Connection Pooling ("reduce the round-trip overhead you just measured"), and Backup/Pooling both frame themselves around keeping a recovered/served database healthy. The narrative arc (protect β speed up β serve efficiently β complete the Keep) is coherent and well-sequenced.
π§ Reasoning & Method¶
- Mode:
executeβ the workflow pre-computed and sealed the evidence by runningtest/quest-validator/agentic_validate.py --mode executeover exactly the three planned quest paths in a disposable sandbox (real PostgreSQL 16 + Docker + psycopg2). I consumedwalk-evidence.json/walk-evidence.mdas-is and did not re-run the engine (its child processes can't authenticate from my Bash tool) or modify the plan/evidence in any way. - What I ran vs. reasoned: I ran no commands myself. Every β
/β in the Evidence
section is a command the sealed engine actually executed; every π§ is a step judged statically (labelled
reasoned) orskippedbecause the Linux sandbox lacks macOS/Windows/sudo. My own contribution is the linked-journey reasoning in Chain Continuity, derived from reading all three quest sources in plan order against the execution evidence. - Coverage / limits: This is window 2 of 2 β 3 of the level's 8 quests. The
four foundational quests were not walked here (swept in a prior window). Snippet coverage per quest: Backup 4/7 runnable ran, Query Optimization 5/9, Connection Pooling ⅚; the remainder were
reasoned/skipped, overwhelmingly OS-specific setup blocks that cannot run on a single Linux sandbox. Sample-output mismatches (Bitmap vs Index Scan) and version notes (recovery.signal) are version/selectivity dependent and are reported as such. No destructive commands were run; all work used freshly created scratch databases. - Confidence: High on the concrete execution failures (each reproduced by the engine against real tooling with quoted errors). High on continuity reasoning (drawn directly from quoted frontmatter/body). Medium on the two "sample output drift" items, which depend on PG version/selectivity and are correctly framed as caveats rather than hard bugs.
One slice, one report. No quest content was modified; no branch, commit, or merge was performed. Fixable bugs are captured in Issues Found for a downstream content pass.