> On Nov 5, 2018, at 7:28 AM, Wasilios Goutas <was...@goutas.de> wrote:
> 
> To speed up pre-processing and importing of data I would like to grand 
> several threads access to the same in memory database

That may not help. SQLite only supports a single writer, so only one connection 
can open a transaction at a time. If multiple threads are trying to write to 
the database (and you use a connection per thread), they’ll end up doing a lot 
of inefficient busy-waiting.

The most efficient design is probably a producer-consumer pattern, with one 
consumer thread writing to the database, being fed data by any number of 
producer threads. (The producer threads can read from the database 
concurrently, as long as the db is in WAL mode.) The writer thread should leave 
one transaction open during the entire import process, to minimize the overhead 
of commits.

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

Reply via email to