You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(storage): add index on raw_conversations.acquired_at #727
raw_conversations has no index on acquired_at, but queries like iter_raw_conversations sort by ORDER BY acquired_at DESC and paginate with LIMIT ? OFFSET ?. For large archives (millions of raw records), this requires a full sort scan on every query.
Additionally, get_known_source_mtimes does SELECT source_path, file_mtime FROM raw_conversations WHERE file_mtime IS NOT NULL with no pagination — loads the entire table into memory.
And EFFECTIVE_RAW_PROVIDER_SQL uses COALESCE(payload_provider, provider_name) which cannot use the simple provider indexes — requires a full scan.
Acceptance criteria
Add index on raw_conversations(acquired_at) for sort-enabled queries.
Add functional index or generated column for COALESCE(payload_provider, provider_name).
Measure query time improvement on the live 68GB archive.
Found by
2026-05-03 performance hot-path analysis (wave 4 subagent analysis). Previously noted in project memory as a known issue — keyset pagination was already used for verify_raw_corpus to work around this.
Activity
Sinity commentedon May 3, 2026
Scope absorbed into #719 (slow ingest investigation). The missing acquired_at index is a performance concern.