See also

https://www.sqlite.org/threadsafe.html


> -----Original Message-----
> From: sqlite-users-boun...@mailinglists.sqlite.org [mailto:sqlite-users-
> boun...@mailinglists.sqlite.org] On Behalf Of Yuri
> Sent: Friday, 17 June, 2016 14:02
> To: SQLite mailing list
> Subject: [sqlite] Why the parallel read of DB is faster with separate
> connections per thread?
> 
> I have a fairly large DB that I need to only read (not write) as fast as
> possible. I open DB with flags
> SQLITE_OPEN_READONLY|SQLITE_OPEN_PRIVATECACHE and then run select
> queries in 8 threads.
> 
> When each thread opens its own connection, DB is read in 8 wallclock
> seconds using 23 user seconds.
> 
> When DB connection is shared by threads, though, the process reads the
> same data in 17 wallclock seconds using 20 user seconds, much slower
> overall, killing the parallelism benefit.
> 
> 
> Reusing RO connection for some reason makes threads wait for each other
> too much. What makes the single connection to slow the process down?
> 
> 
> In an attempt to speed it up as much as possible, I was trying to first
> copy into :memory: db, so that threads would read only from memory, but
> this requires the shared connection and it is slower.
> 
> 
> sqlite3-3.12.2
> 
> 
> Yuri
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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

Reply via email to