2026 07 28 Data Scientist 0110¶
Slice
data-scientist/0110Β· Level 0110 (Database Mastery) Β· Adventurer tier Β· Engine verdict β οΈ warn Β· Walked 2026-07-28π Perfection run Β· π Perfection dashboard Β· π Raw report Β· π Change history
π― Session Summary¶
I walked the Data Scientist path through Level 0110 β Database Mastery (βοΈ Adventurer tier), playing the three quests in the planned window (the tail of an 8-quest level: window 2 of 2, offset 5): Backup and Recovery β Query Optimization β Connection Pooling. Evidence is from the sealed execute-mode engine (walk-evidence.json), which stood up real PostgreSQL 16 in Docker and actually ran each quest's safe snippets in a disposable sandbox.
Headline verdict: β οΈ warn. The conceptual/technical writing across all three quests is strong and accurate, and Query Optimization's SQL runs cleanly end-to-end. But the slice ships two genuinely broken copy-paste snippets in Connection Pooling (both confirmed by execution), a plan-type mismatch in Query Optimization that could make a learner think they failed, and a third quest β Backup and Recovery β that the engine could not score at all (it exhausted its 40-turn budget wrestling with the physical-backup / PITR setup and returned fail/overall 0.0 by timeout, not by a content defect). Maintainer-actionable: fix the two Connection Pooling snippets first β they sit on the quest's own "quickest path."
Machine tally (walk-evidence.md): 2 scored Β· β
1 pass Β· β οΈ 1 warn Β· β 1 fail (engine timeout) Β· avg 72.5% Β· ~$2.09.
πΊοΈ The Journey¶
Plan order (from walk-plan.json), which also respects the dependency chain (Connection Pooling both recommends Query Optimization and is unlocked by the other two, so it correctly comes last):
- β Backup and Recovery: Data Protection for Databases β no score (engine hit max-turns / 0.0) Β· The logical-backup lesson is clean and runnable, but the engine never returned a verdict β it burned all 40 turns trying to stand up physical backup + PITR (which need
sudo/server config the sandbox lacks). Treat as inconclusive, not failed content. - β
Query Optimization: Tuning Fast Database Queries β 80 / pass Β· Core SQL reproduced exactly (Seq Scan β index speedup, composite leftmost-prefix,
LOWER()sargability trap); gaps are a mismatched post-index plan node, a Docker path that skipscreatedb, and an N+1 example against a never-seededuserstable. - β οΈ Connection Pooling: Efficient Database Resource Management β 65 / warn Β· Excellent concepts (connection cost, sizing math, pooling modes, leak diagnosis), but the recommended Docker PgBouncer command and the sample
pgbouncer.iniboth fail when actually run β real copy-paste stoppers.
π¬ Evidence¶
All passed/failed below are commands the execute engine actually ran in the sandbox. Items I judged only from the quest source (no run) are labeled reasoned.
1. Backup and Recovery β pages/_quests/0110/backup-recovery.md β β no verdict (engine timeout)¶
- Snippet coverage: none recorded. The engine terminated with
terminal_reason: max_turnsβ["Reached maximum number of turns (40)"]β soverdict_objis empty andoveralldefaults to0.0. The trailing tool calls in the sealed error show it stuck on physical-backup setup: sudo -u postgres pg_ctlcluster 16 main startandsudo -u postgres createdb test_sudo_checkβ sandbox has no workingsudo, so cluster bring-up for a second server (port 5433) to demopg_basebackup/PITR never succeeded.pg_basebackup -D .../backups/base2 -Ft -z -Pβ attempted repeatedly.- Interpretation (
reasoned): This is an engine-coverage failure, not a demonstrated content bug. The logical-backup path βpg_dump -Fc restoration_vault > vault_backup.dumpβcreatedb restored_vaultβpg_restore(lines 201β209) and the restore-drill in Chapter 3 (lines 290β296) β is self-contained and standard, and is the quest's actual primary objective. The physical-backup and PITR sections (lines 213β258) are where a real learner and the engine get stuck (see Issues). No content defect was witnessed; I cannot report a score.
2. Query Optimization β pages/_quests/0110/query-optimization.md β β
80 (pass)¶
Dimensions: commands_work 4 Β· content_accuracy 4 Β· completeness 3 Β· clarity 4 Β· structure 5 Β· safety 5. Snippets: ran 5/9 runnable Β· 5 passed Β· 0 failed Β· 3 skipped Β· 2 reasoned. weight_covered: 1.0.
passedβ Docker setupdocker run --name speed-sanctum ... postgres:16produced a working PG16 instance.passedβ Seed script created exactly 100,000 rows with all fouractionvalues present.passedβ Ch.1EXPLAIN ANALYZE ... WHERE user_id = 42βSeq Scanwith largeRows Removed by Filter(actual 5.4ms vs. the doc's illustrative 49.1ms β shape matches).passedβ Ch.2 composite index(user_id, action): used foruser_id=42 AND action='login', not used foraction='login'alone β leftmost-prefix rule confirmed precisely.passed(prose-claim check) βLOWER(email)sargability: plain index ignored underWHERE LOWER(email)=...(Seq Scan), expression index fixes it. Claim accurate.- Mismatch witnessed β after
CREATE INDEX idx_events_user_id, PG16 choseBitmap Heap Scan+Bitmap Index Scan, not the doc's shownIndex Scan using idx_events_user_id(lines 265β267). Speedup itself real and dramatic (5.4ms β 0.08ms). reasonedβ Ch.3 N+1 Python is explicit pseudocode (db.query(...)) and references auserstable the seed script never creates; the engine created its ownusersand confirmed the JOIN plans fine.skippedβ macOS/Windows/native-Linux setup blocks (wrong OS / no sudo); syntactically standard, not line-verified.
3. Connection Pooling β pages/_quests/0110/connection-pooling.md β β οΈ 65 (warn)¶
Dimensions: commands_work 2 Β· content_accuracy 3 Β· completeness 4 Β· clarity 4 Β· structure 4 Β· safety 5. Snippets: ran 4/6 runnable Β· 2 passed Β· 2 failed Β· 2 skipped Β· 3 reasoned. weight_covered: 1.0.
failedβ Docker PgBouncer command (lines 184β186) run verbatim: container exited immediately (exit 2) withDB_HOST: Setup pgbouncer config error! You must set DB_HOST env. Theedoburu/pgbouncerimage wantsDB_HOST/DB_USER/DB_PASSWORD, notDATABASES_*(verified against the image's/entrypoint.sh). Even corrected, the defaultlisten_portis 5432, so-p 6432:6432maps to nothing unless-e LISTEN_PORT=6432is added β engine confirmed both the failure and that the fix works.failedβ Ch.3pgbouncer.ini(lines 274β285) run against real PgBouncer 1.25.2:FATAL cannot load config file/ERROR invalid value "transaction ; return the connection after each transaction" for parameter pool_mode. PgBouncer only treats;/#as comments at line-start; the trailing inline comments break it. Removing them makes the file load and pool successfully.passedβSELECT pid, state, query, state_change FROM pg_stat_activity WHERE datname='gatekeeper' ORDER BY state_change;ran against live PG16 and returned expected columns.reasonedβ Ch.1 Python:psycopg2.connect(...)connections have no.execute()method (engine confirmedAttributeErrorwith psycopg2-binary); that pattern is psycopg3's, which the snippet never names.skippedβ brew/winget/native-apt setup blocks (no Homebrew/Windows, no sudo);apt-cache policyconfirmed the package names exist on Ubuntu 24.04.
π Issues Found¶
Every item below cites a witnessed run or an exact quoted line. Backup-and-Recovery items are reasoned (no engine score was produced).
- HIGH Β· Connection Pooling Β· Cloud Realms Docker path (lines 184β186) Β· witnessed β The
edoburu/pgbouncercontainer exits withYou must set DB_HOST envbecause the quest usesDATABASES_HOST/USER/PASSWORD; and even fixed it never listens on 6432. This is the path the quest calls "the quickest way to run both," so the recommended shortcut is the broken one. Fix: useDB_HOST/DB_USER/DB_PASSWORD(+DB_NAME) and add-e LISTEN_PORT=6432. - HIGH Β· Connection Pooling Β· Ch.3
pgbouncer.ini(lines 282β284) Β· witnessed β Trailing inline;comments afterpool_mode,max_client_conn,default_pool_sizemake PgBouncer abort with aFATAL/invalid valueerror. Fix: drop the inline comments or move each to its own line above the setting. - MEDIUM Β· Connection Pooling Β· Ch.1 Python (lines 206β209) Β· witnessed (reasoned run) β
conn = psycopg2.connect(...)thenconn.execute(query)raisesAttributeError(psycopg2 has no connection-levelexecute). Fix: usewith conn.cursor() as cur: cur.execute(...), or switch both blocks to psycopg3 (import psycopg,from psycopg_pool import ConnectionPool) and add the missing imports. - MEDIUM Β· Query Optimization Β· Ch.2 (lines 265β267) + Novice Challenge (line 330) Β· witnessed β Doc shows
Index Scan using idx_events_user_id, but stock PG16 picksBitmap Heap Scan/Bitmap Index Scan; the Novice validation "The plan changes fromSeq ScantoIndex Scan" reads as a literal string match a correct learner will fail. Fix: note that a bitmap index plan also counts as success (both are index-based, not sequential). - MEDIUM Β· Query Optimization Β· Cloud Realms path (lines 183β185) Β· reasoned β The Docker path omits
createdb speed_sanctumthat the macOS/Windows/Linux paths all include, sopsql -U postgreslands in the defaultpostgresDB while the shared "Seed a Large Table" section assumes you're inspeed_sanctum. Fix: addcreatedb speed_sanctum(or aCREATE DATABASE) to the Docker block. - MEDIUM Β· Query Optimization Β· Ch.3 N+1 example (lines 296β311) Β· reasoned β The "fixed" JOIN queries a
userstable the quest's own seed script never creates, so a learner cannot run it againstspeed_sanctumas given. Fix: either label it illustrative-only or add a smallCREATE TABLE users (...)+ seed snippet. - MEDIUM Β· Backup and Recovery Β· Ch.1β2 physical backup / PITR (lines 216, 247, 254) Β· reasoned β
pg_basebackup -D /backups/baseandarchive_command = 'cp %p /backups/wal_archive/%f'reference/backups/...directories the quest never has the learner create, and physical backup + WAL archiving need server-config edits, a restart, and replication privileges that none of the four "Medium" platform setup blocks provide. This gap is almost certainly what stalled the engine into a max-turns timeout. Fix: add themkdir -psteps and a short note that the physical-backup/PITR sections require superuser/server-config access beyond the logical-backup path (or scope them as read-only/optional for a Medium quest). - LOW Β· Query Optimization Β· Objectives (lines 104, 105) Β· reasoned β "Covering Indexes" and "Statistics & ANALYZE" are named secondary objectives but never demonstrated (no
INCLUDE/index-only-scan example; only a one-lineANALYZE). Fix: add short examples or trim the objective list. - LOW Β· Connection Pooling Β· Objectives + Advanced Challenge (lines 104, 333β339) Β· reasoned β "Application Pools" (HikariCP/SQLAlchemy) is a listed bonus but never shown with code, and the Catch-a-Leak challenge gives no starter leak snippet. Fix: add a short SQLAlchemy/HikariCP config and a minimal "forgets to commit" leak example.
No blocking issues in Query Optimization β its verdict is a clean pass; the items above are refinements. Backup and Recovery has no blocking content issue witnessed β its fail is an engine-coverage artifact, called out honestly in Β§7.
π Chain Continuity¶
- This is the tail window of the level.
walk-plan.jsongave me window 2 of 2 (offset 5) of an 8-quest level. The prerequisites these quests assume βsql-mastery(Query Optimization) anddatabase-fundamentals(Backup, Pooling) β live in the earlier window I did not walk, so I can't verify those hand-offs first-hand; within this window the assumed knowledge (reading SQL, running psql, basic JOINs) is reasonable for an Adventurer-tier learner who reached quest 6. - Ordering is sound. Connection Pooling both recommends Query Optimization and is unlocked by Backup/Query, so placing it last is correct. Query Optimization's N+1 / round-trip discussion (Ch.3) sets up Connection Pooling's whole premise ("reduce the round-trip overhead you just measured", line 363) β a genuinely nice thematic hand-off. Backup and Recovery sits somewhat independently (it protects data rather than building on query skills), which is fine.
- Shared PostgreSQL-16-in-Docker spine works. All three use the same
docker run ... postgres:16pattern, so a learner who set it up once carries it forward β good continuity. The friction is that each quest's pooler/second-server extras (PgBouncer container,/backupsdirs, a second cluster) are where the copy-paste path breaks, and those breaks cluster in exactly the two "quickest path" Docker blocks a beginner would reach for first. - Beginner sticking points, in order of likely pain: (1) Connection Pooling's Docker PgBouncer command dies instantly β a real stall on the recommended path; (2) Backup's physical-backup/PITR needs privileges the setup never granted β a learner following the Medium platform block cannot complete Chapter 2 as written; (3) Query Optimization's post-index plan text won't literally match, risking a false "I did it wrong." None of these break the conceptual journey, but two would stop hands-on progress.
π§ Reasoning & Method¶
- What I ran vs. reasoned: I did not run the engine β
walk-evidence.json/walk-evidence.mdwere pre-sealed by the workflow (execute mode, real PostgreSQL 16 in a disposable Docker sandbox) and I consumed them verbatim, as the skill requires. Everypassed/failedabove is a command the engine actually executed; I read all three quest sources in plan order and added the linked-journey reasoning (Β§ Chain Continuity) and thereasonedlabels myself. - Mode:
execute. Two quests returned full schema-constrained verdicts (Query Optimization 80/pass, Connection Pooling 65/warn, bothweight_covered: 1.0). Backup and Recovery returned no verdict βterminal_reason: max_turns, so itsfail/0.0 is a coverage timeout, not a graded outcome. I have deliberately not invented a score for it. - Coverage capped/limited: OS-specific setup blocks (brew/winget/native apt+systemctl+sudo) were
skippedon all quests β the Linux sandbox has no Homebrew/Windows and no workingsudo; those arereasonedas syntactically standard but unverified. Snippet coverage was 5/9 (Query Optimization) and 4/6 (Connection Pooling) runnable snippets; Backup and Recovery has no recorded snippet run. - Confidence: High on the two Connection Pooling HIGH issues and the Query Optimization plan-mismatch (directly executed and reproduced). Medium on the reasoned items (N+1
userstable, Dockercreatedbomission, missing objectives). For Backup and Recovery I am confident only that the engine timed out on physical-backup setup; I am not claiming its content passes or fails β it is inconclusive and needs a re-run (or a scope note in the quest) to score. - Scope discipline: One slice, one report. No quest content was edited; no git action taken. Fixable bugs are in Β§ Issues for a content pass to act on.