perf(eventcore-sqlite): batch INSERT in append_events (#362) #404
No reviewers
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Slipstream/eventcore!404
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "perf/362-sqlite-batch-insert"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replaces the per-event
INSERTloop inSqliteEventStore::append_eventswith a single multi-rowINSERT ... VALUES (...),(...)statement, chunked to stay well under SQLite'sSQLITE_MAX_VARIABLE_NUMBERbound-parameter limit (100 rows / 500 params per statement). All events in oneappend_eventscall already share a single transaction, so batching them into one statement removes per-event statement-preparation overhead.Behavior
Unchanged. Per-stream versions are still assigned sequentially, and the optimistic-concurrency version checks still run before any write. Verified by the existing backend contract suite plus a new integration test that appends a 250-event batch (crossing the 100-row chunk boundary) and reads it back.
Workflow note
Phases 1-3 are not applicable: this is a behavior-preserving internal optimization with no public API change and acceptance criteria already specified in the issue. Existing contract + integration tests are the regression safety net (Phase 4 TDD).
Closes #362
This PR optimizes the
append_eventsfunction by batching INSERT operations into a single multi-row statement, improving performance without changing behavior. The changes are well-tested and appear safe to merge.Walkthrough
bound_valuesto collect parameters for the batched INSERT.LLM usage and cost
Estimated total USD: $0.015862 via https://api.openai.com and https://api.openai.com