pierr wrote:
> Hi,
>   My sqlite is configure as serialized (THREADSAFE=1). My application
> has only one connection but it is shared by two thread. One thread
> will do insert/update/delete in the background , another thread will
> do the select upon request of the user from gui.
>  Typically, we will call following function 12 times (with different
> parameters ,of course)before showing the pages to user. In the
> standalone test (single  thread), a call to following function will
> take less than 40ms, so 12 times will take less than 500 ms and it is
> acceptable. However, in the real application, sometimes this function
> took 1000ms to return the result which make the gui slow.

When the second thread makes SQLite calls, it takes a lock on the 
connection. If the UI thread runs a SELECT at this moment, it also tries 
to take that lock, and so has to wait until the second thread releases 
it.

>   Any insight? Should I go with THREADSAFE=2 and two connections: one
> for read ,another for write? Thanks.

THREADSAFE is not a number of allowed concurrent threads. It's a boolean 
switch - 0 means non-threadsafe, non-zero means thread-safe. 
THREADSAFE=2 won't make any difference.

Further, you cannot open two connections to the same in-memory database.

Igor Tandetnik 



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

Reply via email to