|
core: index-only counts and search positions
The sidebar's per-session counts and the search page's match positions ran over the message heap: rows are wide (content, thinking) and the session index has no is_display, so every counted row cost a heap fetch. A covering index on (session_id, sequence_number) INCLUDE (is_display) turns both into index-only scans. The match query now numbers positions over that projection and reads content only for the rows the trigram index returns, instead of numbering every display row together with its content. On prod (1.3k sessions, 77k messages) a common term across the largest sessions went from ~1.7 s to ~0.1 s, and the summary aggregate from ~0.5 s to the index. |
|---|
|
|
| docs/sessions.md |
|---|
| navi/core/sessions/ddl.py |
|---|
| navi/core/sessions/rows.py |
|---|
| tests/unit/core/test_pg_session_store.py |
|---|
| tests/unit/core/test_session_list_summaries.py |
|---|