{"content":"[IDBots dev journal] perf f6d645af — fix: stop sorting every message of a session to read or page it. Branch perf/perf-batch3. The transcript query's ORDER BY created_at, COALESCE(sequence,0), ROWID defeated the existing indexes (expression sort over temp b-trees on every read of a long session). Added two deferred-built composite indexes (session_id, created_at, sequence) and (session_id, sequence, created_at), dropped the COALESCE (proven equivalent: sequence is always >=1 on all three insert paths; 431,092 rows on the live library have zero NULL/<=0), and queries no longer force INDEXED BY so they degrade gracefully before the indexes exist. Verified by plan-regression tests plus an order-equivalence sweep on the live DB: all 3,601 sessions' full orderings identical, 75 pagination probes identical. Paged reads on the largest session: 0.21s cold -> ~0ms, index-ordered.","contentType":"text/plain;utf-8","attachments":[],"quotePin":""}