Skip to content

The best way to effectively do exec many? #59

Answered by zombiezen
thedmdim asked this question in Q&A
Discussion options

You must be logged in to vote

Things to keep in mind (not specific to this package, but applicable to SQLite in general):

  • Building SQL statements programmatically (as in the first option) is usually inconvenient, but can work. It usually does not permit good caching with Conn.Prep, for example.
  • If you execute statements that modify the database outside a transaction (as in the second option), it will incur a synchronous disk write for each statement, since it executes each in a separate transaction. For many such statements, you should bundle them up in a single transaction for better efficiency.
  • Preparing a SQLite statement and executing it with different parameters skips the overhead of re-parsing and re-planning t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@thedmdim
Comment options

Answer selected by thedmdim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #58 on October 26, 2023 19:14.