Skip to content

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):

  1. ❌ 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.
  2. βœ… 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 skips createdb, and an N+1 example against a never-seeded users table.
  3. ⚠️ 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.ini both 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)"] β€” so verdict_obj is empty and overall defaults to 0.0. The trailing tool calls in the sealed error show it stuck on physical-backup setup:
  • sudo -u postgres pg_ctlcluster 16 main start and sudo -u postgres createdb test_sudo_check β€” sandbox has no working sudo, so cluster bring-up for a second server (port 5433) to demo pg_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 setup docker run --name speed-sanctum ... postgres:16 produced a working PG16 instance.
  • passed β€” Seed script created exactly 100,000 rows with all four action values present.
  • passed β€” Ch.1 EXPLAIN ANALYZE ... WHERE user_id = 42 β†’ Seq Scan with large Rows Removed by Filter (actual 5.4ms vs. the doc's illustrative 49.1ms β€” shape matches).
  • passed β€” Ch.2 composite index (user_id, action): used for user_id=42 AND action='login', not used for action='login' alone β†’ leftmost-prefix rule confirmed precisely.
  • passed (prose-claim check) β€” LOWER(email) sargability: plain index ignored under WHERE LOWER(email)=... (Seq Scan), expression index fixes it. Claim accurate.
  • Mismatch witnessed β€” after CREATE INDEX idx_events_user_id, PG16 chose Bitmap Heap Scan + Bitmap Index Scan, not the doc's shown Index 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 a users table the seed script never creates; the engine created its own users and 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) with DB_HOST: Setup pgbouncer config error! You must set DB_HOST env. The edoburu/pgbouncer image wants DB_HOST/DB_USER/DB_PASSWORD, not DATABASES_* (verified against the image's /entrypoint.sh). Even corrected, the default listen_port is 5432, so -p 6432:6432 maps to nothing unless -e LISTEN_PORT=6432 is added β€” engine confirmed both the failure and that the fix works.
  • failed β€” Ch.3 pgbouncer.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 confirmed AttributeError with 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 policy confirmed 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/pgbouncer container exits with You must set DB_HOST env because the quest uses DATABASES_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: use DB_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 after pool_mode, max_client_conn, default_pool_size make PgBouncer abort with a FATAL/invalid value error. 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(...) then conn.execute(query) raises AttributeError (psycopg2 has no connection-level execute). Fix: use with 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 picks Bitmap Heap Scan/Bitmap Index Scan; the Novice validation "The plan changes from Seq Scan to Index 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_sanctum that the macOS/Windows/Linux paths all include, so psql -U postgres lands in the default postgres DB while the shared "Seed a Large Table" section assumes you're in speed_sanctum. Fix: add createdb speed_sanctum (or a CREATE DATABASE) to the Docker block.
  • MEDIUM Β· Query Optimization Β· Ch.3 N+1 example (lines 296–311) Β· reasoned β€” The "fixed" JOIN queries a users table the quest's own seed script never creates, so a learner cannot run it against speed_sanctum as given. Fix: either label it illustrative-only or add a small CREATE TABLE users (...) + seed snippet.
  • MEDIUM Β· Backup and Recovery Β· Ch.1–2 physical backup / PITR (lines 216, 247, 254) Β· reasoned β€” pg_basebackup -D /backups/base and archive_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 the mkdir -p steps 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-line ANALYZE). 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.json gave me window 2 of 2 (offset 5) of an 8-quest level. The prerequisites these quests assume β€” sql-mastery (Query Optimization) and database-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:16 pattern, 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, /backups dirs, 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.md were pre-sealed by the workflow (execute mode, real PostgreSQL 16 in a disposable Docker sandbox) and I consumed them verbatim, as the skill requires. Every passed/failed above 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 the reasoned labels myself.
  • Mode: execute. Two quests returned full schema-constrained verdicts (Query Optimization 80/pass, Connection Pooling 65/warn, both weight_covered: 1.0). Backup and Recovery returned no verdict β€” terminal_reason: max_turns, so its fail/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 skipped on all quests β€” the Linux sandbox has no Homebrew/Windows and no working sudo; those are reasoned as 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 users table, Docker createdb omission, 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.