perf: batch INSERT for SQLite append_events #362
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jwilger/eventcore#362
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Problem
SqliteEventStore::append_events()runs a separate INSERT statement per event inside a transaction, similar to the PostgreSQL backend.Proposed Solution
Replace the per-event INSERT loop with a single multi-row INSERT statement. SQLite supports
INSERT INTO ... VALUES (...), (...), (...)syntax.Expected Impact
Moderate improvement on larger batches. Less impactful than the PostgreSQL optimization since SQLite is in-process (no network round-trip per statement), but reducing statement preparation overhead should still help.
Location
eventcore-sqlite/src/lib.rs—append_events()method.Benchmark Baseline
Run
cargo bench -p eventcore-bench --bench store_operations -- 'store/append/sqlite'to measure before/after.