"Graeme" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Friday 19 September 2008 09:50:53 Igor Tandetnik wrote:
>> <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>
>>> Can SQLite take advantage of multiple CPU's and/or multiple
>>> cores?
>>
>> Not automatically: SQLite API functions run on whatever thread you
>> call them on. Of course, you can create multiple threads and open
>> multiple SQLite connections - preferably to different DB files, to
>> maximize concurrency.
>
> Looking at the docs and the wiki it looks to me that there are no
> problems with multiple processes using the same DB, but one needs to
> be a bit more careful with threads (and you have to be sure it is
> compiled with threads enabled).

It doesn't matter whether several DB connections belong to multiple 
processes or to multiple threads within the same process. The locking 
scheme is exactly the same (except when shared cache is enabled, which 
supports some interesting features, e.g. per-table locking).

Modern versions of SQLite are also safe for sharing the same connection 
across threads. However, it's implemented by simply having every API 
call lock the same mutex, so potential for concurrency is somewhat 
limited.

> Also, are there any disadvantages to compiling threadsafe? I imagine
> there is some impact on performance. Anything else?

Not that I know of.

Igor Tandetnik 



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

Reply via email to