2 ms·
Along the same lines, SQLite is unlike other RDBMS in that you typically do NOT want to create a new connection per logical unit of work, because that means ope
by bob1029 3y ago
Along the same lines, SQLite is unlike other RDBMS in that you typically do NOT want to create a new connection per logical unit of work, because that means opening an actual file on disk each time. The more you can re-use a SQLite connection instance the better.
SQLite is internally handling the locking for you under most providers[0]. Any sort of external attempts at the same will just make things go slower. The only thing that could really beat the internal SQLite mutex is to put a very high performance MPSC queue in front of your single SQLite connection and take resulting micro batches of logical requests into transactions as noted above, or some more consolidated form of representation.
[0]: https://www.sqlite.org/compile.html#threadsafe https://www.sqlite.org/compile.html#threadsafe
- chii 3y ago> SQLite is unlike other RDBMS in that you typically do NOT want to create a new connection per logical unit of work i would've imagined that most RDBMS would have a pool of connections that get reused, rather than creating a new connection every time.
- mrkeen 3y agoIn Java-land it's usually up to the application/libraries to manage this. I see Hikari used a lot.