Skip to content

perf: batch INSERT for SQLite append_events #362

@jwilger-ai-bot

Description

@jwilger-ai-bot

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.rsappend_events() method.

Benchmark Baseline

Run cargo bench -p eventcore-bench --bench store_operations -- 'store/append/sqlite' to measure before/after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3-lowPolish, optimizationenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions