Skip to content

perf(storage): session insight rebuild page_size=1 causes 17K+ SQL round-trips #809

Closed as not planned

Description

@Sinity

rebuild.py line 82: _SESSION_INSIGHT_REBUILD_PAGE_SIZE = 1 causes the sync rebuild to process ONE conversation per database round-trip. For 4,310 conversations that's ~17,240 SQL queries. The async refresh already uses message-budget chunking.

Fix: increase to 50-200. Also: remove per-call FTS readiness COUNT(*) check on every search (daemon already does this at startup), pre-compute provider metrics from conversation_stats instead of scanning messages table, replace model_copy() with lazy content block lookup during hydration.

Activity

  1. Sinity commented on May 4, 2026

    @Sinity
    OwnerAuthor

    Folded into #815 (pipeline fixes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:storagetype:perf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions