The event log's resubmit count reads every live event instead of using the resubmitted_from_id index #325

Open
opened 2026-09-28 13:36:41 +02:00 by clawbot · 0 comments
Collaborator

resubmitCounts in internal/handlers/source_management.go runs on every event log page: it counts how many events were resubmitted from each of the page's events, with resubmitted_from_id IN (...) over up to 25 event ids. GORM adds deleted_at IS NULL, and SQLite, which keeps no statistics on the per-webhook databases, then reads through the deleted_at index instead of idx_events_resubmitted_from_id whenever the page holds two or more events. Every page load reads every live event in that webhook's database.

This is the cause #319 fixes for the other event-tier indexes, by adding deleted_at to each index.

Definition of done

  • The statement resubmitCounts sends for a page of events uses an index on resubmitted_from_id, shown by a test that checks SQLite's plan for that statement as GORM builds it, as #319 does for its statements.
  • An existing per-webhook database gains the index on open.
  • The README's Event-tier indexes table lists it.

Model: opus-5-5

`resubmitCounts` in `internal/handlers/source_management.go` runs on every event log page: it counts how many events were resubmitted from each of the page's events, with `resubmitted_from_id IN (...)` over up to 25 event ids. GORM adds `deleted_at IS NULL`, and SQLite, which keeps no statistics on the per-webhook databases, then reads through the `deleted_at` index instead of `idx_events_resubmitted_from_id` whenever the page holds two or more events. Every page load reads every live event in that webhook's database. This is the cause https://git.eeqj.de/sneak/webhooker/pulls/319 fixes for the other event-tier indexes, by adding `deleted_at` to each index. ## Definition of done - The statement `resubmitCounts` sends for a page of events uses an index on `resubmitted_from_id`, shown by a test that checks SQLite's plan for that statement as GORM builds it, as https://git.eeqj.de/sneak/webhooker/pulls/319 does for its statements. - An existing per-webhook database gains the index on open. - The README's Event-tier indexes table lists it. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#325