# STUDY_PLAN — 12 Days, Nov 5–16

## Daily repetition stack (every day, in order)

1. Say scoring words aloud (00_START_HERE).
2. Replay yesterday's audio once at 1.25x.
3. Recite intro spine from memory (CHEAT_SHEET §6).
4. One STAR story aloud with its metric.
5. New day's Focus + Listen + Lab below.
6. Done-check before bed.

## Days 1–12

### Day 1 — PG architecture
- Focus: postmaster, backends, shared_buffers, WAL writer, checkpointer, autovacuum launcher.
- Listen: E1. Lab: install PG locally, pgbench smoke, `SELECT * FROM pg_stat_activity;`.
- Say-aloud: "Durability comes from WAL; checkpoints bound recovery time."
- Desk: sketch process + buffer + WAL diagram. Done-check: name all writers + clock role.

### Day 2 — MVCC
- Focus: snapshots, xmin/xmax, tuple visibility, HOT updates, vacuum/AUTOVACUUM, bloat, wraparound risk.
- Listen: E2. Lab: create bloat (repeated updates), measure with pgstattuple, VACUUM, compare.
- Say-aloud: "Writers don't block readers; dead tuples cost until vacuumed."
- Desk: draw tuple chain with xmin/xmax. Done-check: explain bloat vs wraparound.

### Day 3 — WAL + replication
- Focus: LSN, WAL levels, streaming replication, sync vs async, lag, switchover vs failover, timeline.
- Listen: E3. Lab: replica lag drill (pg_stat_replication), planned switchover write-up.
- Say-aloud: "Sync replication trades latency for zero data loss."
- Desk: lag-source table (network/apply/load). Done-check: state RPO for sync vs async.

### Day 4 — Indexing
- Focus: B-tree structure, composite/covering/partial indexes, index bloat, write amplification, unused-index cost.
- Listen: E4. Lab: take one slow query, EXPLAIN ANALYZE, add/verify index, check write cost.
- Say-aloud: "Index the filter you run, not the column you like."
- Desk: index-pick checklist. Done-check: name 3 index traps.

### Day 5 — Planner + optimizer
- Focus: pg_statistic, ANALYZE, cardinality misestimates, nested-loop vs hash vs merge join, enable_* temptation.
- Listen: E5. Lab: stale-stats broken plan → ANALYZE → re-verify plan change.
- Say-aloud: "The planner is only as good as its statistics."
- Desk: plan-reading runbook. Done-check: explain one misestimate fix without enable_* hacks.

### Day 6 — RocksDB / LSM
- Focus: memtable/WAL/SSTs, levels, compaction strategies (leveled/universal), read/write/space amplification.
- Listen: E6. Lab: read one RocksDB wiki tuning page, narrate two knobs' trade-offs aloud.
- Say-aloud: "Compaction trades write cost now for read cost later."
- Desk: LSM-vs-B-tree table. Done-check: define all three amplifications.

### Day 7 — Consensus
- Focus: Raft leader election, log replication, commit index, quorum math (2f+1), split-brain/fencing.
- Listen: E7. Lab: quorum-loss table for 3- and 5-node clusters; fencing write-up.
- Say-aloud: "A minority partition stops accepting writes — that is safety."
- Desk: draw election + commit flow. Done-check: quorum sizes for 3 and 5 from memory.

### Day 8 — K8s control plane for stateful DBs
- Focus: StatefulSets, PVCs/storage classes, operators, PDBs, rolling tenant moves, readiness vs liveness.
- Listen: E8. Lab: draft a zero-downtime tenant-move runbook (prechecks, move, verify, rollback).
- Say-aloud: "Stateful moves need fencing, draining, and a rollback that works."
- Desk: move-runbook one-pager. Done-check: PDB vs readiness split.

### Day 9 — Tail latency
- Focus: p50/p99/p999, histogram reading, kernel tracing (perf/eBPF) narration, GC/pauses, noisy neighbor, QoS.
- Listen: E9. Lab: run pgbench, read latency histogram, write mitigation plan for the p99 source.
- Say-aloud: "Averages lie; fix the tail by measuring the tail."
- Desk: latency-source checklist. Done-check: name 3 non-query p99 causes.

### Day 10 — System design at Roblox scale
- Focus: multi-tenant sharded PG: shard key, tenant isolation/noisy-neighbor, elastic scale, cross-region reads.
- Listen: E10. Lab: whiteboard marketplace buy/sell/rent flow (2022 Principal onsite prompt) end to end.
- Say-aloud: "Shard by the query pattern, isolate by the tenant."
- Desk: design one-pager with trade-offs. Done-check: defend shard key + failover story.

### Day 11 — STAR bank + intro + OSS framing
- Focus: 6-story STAR reps, 90-sec intro spine, upstream-contribution narration (issue → repro → patch → review).
- Listen: E10. Lab: timed STAR reps with metrics; record intro once.
- Say-aloud: full 90-sec intro. Done-check: every story has a metric.

### Day 12 — Mock loop
- Focus: internals deep dive + system design + behavioral simulation.
- Listen: E10. Lab: full timed mock, gap list ≤5 with owners.
- Rounds: (1) PG internals deep dive (MVCC/WAL/index), (2) sharded multi-tenant design, (3) behavioral STAR with metrics, (4) failure-drill scenario. Narrate method at each step.
- Say-aloud: weakest answer 3x. Done-check: gap list ≤5 items with owners.

## BASE-TO-BUILD

| Base (23 yr Oracle/TSE) | Build (Principal Roblox Database) |
|------|------|
| RAC cache fusion / interconnect / fencing | Raft quorum + fencing + multi-region replication narration |
| Data Guard FSFO / lag / switchover-failover | PG streaming replication lag triage + RPO/RTO statements |
| GoldenGate CDC / conflict resolution | WAL logical decoding + sharding/tenant-move method |
| AWR/ASH/ADDM + execution plans | EXPLAIN ANALYZE + pg_stat_* + PI-style top-SQL + kernel-trace narration |
| RMAN backups / PITR | PG base backup + WAL archiving + PITR drill |
| Enterprise escalations + product feedback to Eng | Design reviews + benchmarks + failure drills + OSS upstream framing |
| Runbook fixes | Autonomous-healing + automation + mentor-others framing |

### Honest depth tags (use these exact words in every answer)

- **Debug**: I have hands-on reps and can walk the full triage with commands (PG ops, replication lag, plans, bloat/vacuum, pgbench latency reads). Claim freely.
- **Recognize**: I can read the code/structure and narrate the method accurately but have not implemented it (RocksDB compaction paths, planner internals, Raft log code, eBPF/perf traces, K8s operator internals). Say: "I recognize this from reading X; my method would be Y."
- **Do-not-claim**: C++/engine-internals implementation (writing PG executor code, RocksDB compaction code, Raft from scratch, kernel modules). Never claim; redirect to method + reading-comprehension + learning plan.
