A runbook: the order to present in, the exact commands to run, where to pause,
and what to tailor per audience. It deliberately contains no scripted technical
answers, algorithm explanations, or Q&A — prepare those yourself from the code
and DESIGN.md. Section 5 lists topics to rehearse (with file pointers); the
answers are intentionally left out.
-
pip install -e ".[test]"has been run;python -m queryxlaunches. - Terminal font is large; window is wide enough for boxed tables and
.tree. - Start from a clean demo dir each run:
Remove-Item -Recurse -Force demo(PowerShell) /rm -rf demo. - Browser tab open on the GitHub repo (README rendered + the green tests CI badge).
- Decide your length: ~8 min (sections marked
[core]) or ~15 min (all). - The two demo scripts self-clean and are safe to re-run; rehearse them once.
- Hook — "a relational database engine, from scratch, standard library only." (repo + green CI)
- Architecture — the layered pipeline, dependencies pointing down. (README Mermaid diagram)
- It really runs SQL — the shell: CREATE / multi-row INSERT / SELECT / GROUP BY / JOIN / EXPLAIN.
- Not a CRUD app — a real engine — expose the internals live:
.stats,.pages,.tree. - The money shot — crash recovery: corrupt the disk, recover from the WAL.
- Why it's fast / honest scope — index vs sequential scan, benchmarks, then the deliberate simplifications.
Keep each beat short; the demos carry the weight.
pytest -qCue: point at the passing count; switch to the browser tab showing the green CI badge.
python -m queryx demoType these (also in examples/sample_queries.sql to paste):
CREATE TABLE employees (id INT, name TEXT, dept_id INT, salary INT, age INT);
INSERT INTO employees VALUES
(1,'alice',1,95000,30), (2,'bob',1,80000,25), (3,'carol',2,70000,40),
(4,'dave',2,60000,35), (5,'erin',3,75000,28), (6,'frank',1,120000,45);
SELECT name, salary FROM employees WHERE salary >= 80000 ORDER BY salary DESC;
SELECT dept_id, COUNT(*), AVG(salary) FROM employees GROUP BY dept_id HAVING COUNT(*) >= 2;
CREATE TABLE departments (id INT, name TEXT);
INSERT INTO departments VALUES (1,'Engineering'), (2,'Sales'), (3,'Marketing');
SELECT e.name, d.name FROM employees e JOIN departments d ON e.dept_id = d.id;
EXPLAIN SELECT name FROM employees WHERE id = 3;Cues (where to point — not what to explain): the boxed result + timing footer; the
GROUP BY aggregation; the two-table join; the EXPLAIN plan tree.
Continue in the same shell:
.stats
.pages employees
CREATE INDEX idx_id ON employees (id);
.tree idx_id
.quit
Cues: the buffer-pool hit ratio on .stats; rows packed into a 4KB page on
.pages; the actual B+ tree on .tree. (Small table → .tree is height 1; for a
deeper tree show it inside the index demo in step E, which loads 10k rows.)
python examples/crash_recovery_demo.pyCues (stage directions): pause when the page is zeroed ('alice' gone from
disk), then again on the green PASS line — let it land. This is the moment.
python examples/index_vs_seqscan_demo.pyCues: the EXPLAIN plan flips SeqScan → IndexScan; point at the cost numbers
and the measured speedup.
python benchmarks/benchmark_suite.py…or just open benchmarks/REPORT.md and the chart. Cue: say plainly these are in-process microbenchmarks (relative behaviour, not production latency).
Open the README "How QueryX compares to SQLite / PostgreSQL" table and the "Future work" section. Cue: frame the simplifications as deliberate scope decisions — honesty is the close.
- Crash recovery (step D) — the zero-the-page-then-recover. Biggest moment; slow down here.
- Self-inspecting engine (step C) —
.stats/.pages/.tree. "It shows its own internals." - Optimizer flip + speedup (step E) —
EXPLAINchanges its mind and the clock proves it.
For each: pause, let the screen settle, and point — don't talk over the reveal.
- Database engineer: spend your time on C, D, E and the EXPLAIN cost numbers;
move fast through basic SQL (B). Expect deep questions — see §5. Have
DESIGN.mdopen (failure analysis, WAL boundary). - Recruiter / non-specialist: lead with the polished shell (B), the green CI badge, and the README; make crash recovery (D) the one demo they remember; keep internals (C) brief.
- General professor / examiner: run the full arc A→G; emphasise the test suite, the BNF grammar, and the honesty of the scope decisions. Be ready to trace any shown feature to its code.
Prompts an examiner is likely to probe. Answers are intentionally not written here — work them out from the listed files so you can defend them in your own words.
- Slotted pages: why is a row's identity its slot, not its byte offset? →
queryx/storage/page.py - Buffer pool: eviction policy and write-back; what does the hit ratio mean? →
queryx/storage/buffer_pool.py - B+ tree vs a binary search tree — why is it shallow? What is fan-out? →
queryx/index/btree.py - B+ tree vs hash index — when does each win? Why can't hash range-scan? →
queryx/index/,benchmarks/REPORT.md - Volcano model: which operators are blocking and why? →
queryx/execution/operators.py - Optimizer: why does it pick a SeqScan on a small table? How is selectivity estimated? →
queryx/planner/ - WAL: what exactly does it guarantee, and what is the checkpoint boundary? →
queryx/wal/, README crash-recovery note - The biggest thing you deliberately left out (transactions/MVCC) — why, and what would it take? →
DESIGN.md(future work)
- Always start demos from a fresh directory; the example scripts self-clean.
- If the shell gets into a confusing state:
.quit, delete the demo dir, relaunch. - The two example scripts are designed to run repeatably — if a run looks off, just re-run it.
- Worst case, fall back to the committed benchmarks/REPORT.md and the README diagrams.