Django 6.1.3 on SQLite (in-memory): ch08-bench 1. Python Query+as_sql() vs total execution vs raw SQLite (7 trials, us/query) shape compile_us sqlite_us total_us compile_pct sql_chars simple_filter 184.6 19.1 244.0 75.7% 143 two_fk_joins 281.0 21.1 346.5 81.1% 354 m2m_chained_2_aliases 342.0 23.0 402.4 85.0% 427 correlated_exists 524.9 19.0 585.5 89.7% 225 window_qualify 729.9 34.9 900.5 81.0% 397 2. Join fan-out scaling: 20 stories x (N beats * N corrections), 7 trials (ms) N_each joined_rows distinct_ms subquery_ms speedup 5 500 0.842 1.201 0.70x 10 2000 1.163 1.161 1.00x 20 8000 2.952 1.174 2.51x 30 18000 5.590 1.213 4.61x