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
Commit e7b5c1d
Browse filesBrowse the repository at this point in the historyBrowse files
perf(server): reads of a long thread no longer touch every row
On a thread with tens of thousands of items, the shell item count looked up
each run in the main runs table, the command read walked every item to find
user messages and errors, and the provider-thread read looked each node up
through a non-covering index. Add compact covering indexes for those
lookups and hint them where the planner prefers the primary key or the
ordinal index.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
SELECT json_extract(payload_json, '$.messageId') AS message_id, MIN(ordinal) AS ordinal
3734
3741
FROM orchestration_v2_projection_turn_items
3735
-
WHERE thread_id = ${threadId} AND type IN ('user_message', 'assistant_message')
3742
+
INDEXED BY orchestration_v2_projection_turn_items_thread_type_idx
3743
+
WHERE (thread_id || '') = ${threadId} AND (type || '') IN ('user_message', 'assistant_message')
3736
3744
${loadedMessageIds===undefined ? sql`` : sql`AND json_extract(payload_json, '$.messageId') IN (SELECT value FROM json_each(${encodeIdList(loadedMessageIds)}))`}
3737
3745
GROUP BY json_extract(payload_json, '$.messageId')
0 commit comments