Skip to content

fix(storage): index session list queries#38684

Open
literally-dan wants to merge 1 commit into
anomalyco:devfrom
literally-dan:session-list-indexes
Open

fix(storage): index session list queries#38684
literally-dan wants to merge 1 commit into
anomalyco:devfrom
literally-dan:session-list-indexes

Conversation

@literally-dan

Copy link
Copy Markdown

Issue for this PR

Closes #30609

This replaces #30636, which was closed by automated cleanup. I rebased the change on the current dev branch and updated the indexes to match the queries now used by session lists.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Session lists sort by update time, but the existing indexes cover only their filter columns. The project index is now (project_id, time_updated), the root-session index is (parent_id, time_updated, id), and the global list has (time_updated, id). Project and parent lookups can still use the leftmost columns of those indexes.

The migration replaces the old single-column indexes. It also handles databases that tested the earlier single-column session_time_updated_idx.

How did you verify your code works?

bun test test/database-migration.test.ts passes all 18 tests. bun typecheck and bun script/migration.ts --check also pass in packages/core.

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session list and history queries do full table scans

1 participant