Replies: 2 comments 3 replies
-
TBH, to the extent that I use this driver (mostly mucking around, nothing critical), relying on Likely the biggest improvement to be had with My advice for
Only if you hit concurrency issues, then create two separate read/write pools, and Or maybe try the That said, I know you were probably looking for not |
Beta Was this translation helpful? Give feedback.
-
For non That said, API ergonomics aside, I agree that a connection pool matters, even more so with my driver, as it turns out setting up a new wazero instance is itself somewhat heavy. I'm really not sure how much you get from statement caching. I don't necessarily agree enough with his API ergonomics decisions to think it is worth it for me to build another connection pool; I believe Footnotes
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
From what I can tell reading SQLite documentation and blog posts, it seems beneficial for frequently occuring queries to prepare a statement once and then reuse it multiple times (by calling
Reset()
). This means we don't spend time compiling the query repeatedly. You'd have to do that afterOpen()
and ensure to finalise all statements beforeClose()
.However, prepared statements aren't safe for concurrent use best I can tell. That would interact fairly poorly with a slew of Go routines handling incoming HTTP requests which all want to use the same statement as they'd clobber all over each other during
Bind()
calls. This would mean needing to serialise access to a prepared statement, since there doesn't appear to be any way to copy or clone one in the SQLite API.I've been trying to think through what I could do to enable prepared statement reuse in an application:
What do people typically do here? Have folks found that statement reuse is beneficial, and if so how did you approach it?
Beta Was this translation helpful? Give feedback.
All reactions