Skip to content

Session list and history queries do full table scans #30609

Closed as not planned
Closed as not planned

Description

@literally-dan

Description

The global session list orders by time_updated (it runs on every TUI startup and every time the session-list dialog opens), but the session table has no index on time_updated, so the ORDER BY time_updated DESC LIMIT N query does a full table scan that gets slower as sessions accumulate.

An earlier version of this report also covered the event-history query on event(aggregate_id, seq), but that index already exists upstream, so this is now scoped to the session list.

I have a fix that adds the index with a migration.

Plugins

None

OpenCode version

1.15.13

Steps to reproduce

  1. Open the session-list dialog (or start the TUI) with a large number of sessions; the global list runs ORDER BY time_updated DESC with no supporting index.
  2. Run EXPLAIN QUERY PLAN on it; it reports a full table scan of session.

Screenshot and/or share link

No response

Operating System

Linux 6.17.0-29-generic

Terminal

foot

Activity

  1. literally-dan commented on Jun 3, 2026

    @literally-dan
    Author

    Closing this, I opened it before it was ready for review. I'll reopen once I've gone over it properly.

  2. github-actions commented on Aug 9, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions