> On Dec 30, 2018, at 7:52 AM, Jesse Rittner <rittneje+sql...@gmail.com> wrote:
> 
> It
> seems to me that there are two ways we can have multiple threads all
> accessing a database via a "single" connection.

Actually there is at least one more way: Create a global connection pool. When 
a thread needs to access the database, it borrows a connection from the pool, 
does its work, and then returns it back to the pool. This approach even 
preserves isolation, as long as a thread that opens a transaction doesn’t 
return the connection until after it commits.

If a thread wants a connection but the pool is empty, it can either open a new 
connection or it can block until another thread returns one. It’s a tradeoff 
between availability and memory usage, basically.

—Jens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to