mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 15:50:08 +09:00
ca626ea7e2
Every room visit and every reconnection asks for the messages updated since the page was rendered. That query filtered the room by updated_at and sorted it by created_at, so SQLite walked every message in the room: about 220-360 ms in a room of a million messages. An index on (room_id, updated_at) finds the few updated messages directly. Sorting on +created_at keeps SQLite on that index once messages are also indexed by (room_id, created_at): with both, the planner otherwise walks the room in creation order looking for updated rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JVFo3Lt9T8M5NR7KxVvsZ2