Skip to content

sqlite storage: wrap store batch in a single transaction - #25

Merged
tiensonqin merged 1 commit into
mainfrom
devin/sqlite-single-txn
Oct 1, 2026
Merged

tiensonqin merged 1 commit into
mainfrom
devin/sqlite-single-txn

Conversation

@tiensonqin

Copy link
Copy Markdown
Contributor

Summary

storage_store concatenates all upserts into one sqlite3_exec batch, but without an explicit transaction each statement commits in its own implicit transaction — a bulk store of N entries costs N fsync-bound commits.

Measured on a ~130 MB index build (Out's 4k-movies benchmark graph): the store phase spent ~50s almost entirely inside vdbeCommit/sqlite3PagerCommitPhaseOne/unixSync. Wrapping the batch in BEGIN IMMEDIATE/COMMIT collapses it into one transaction: saving phase 50s → 5.3s, total first import 68.8s → 22.4s.

Link to Devin session: https://app.devin.ai/sessions/87d07eb19d674693adeffdb53332c183
Open in Devin Desktop: https://app.devin.ai/desktop/session/87d07eb19d674693adeffdb53332c183?variant=devin
Requested by: @tiensonqin

sqlite3_exec commits each statement in its own implicit transaction,
so a bulk store of N entries costs N fsync-bound commits. Wrapping the
upsert batch in BEGIN IMMEDIATE/COMMIT collapses it to one commit.
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@tiensonqin
tiensonqin merged commit ff84941 into main Oct 1, 2026
1 of 2 checks passed
@tiensonqin
tiensonqin deleted the devin/sqlite-single-txn branch October 1, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant