Does anybody know why I would be getting SQLITE_BUSY when closing the
database connection in each thread even though I have finalized all
prepared statements and am not doing any outstanding commands on the
database? I have tests that need to copy the database file once the
application has finished and then delete it to clear up and they cannot
delete the file because "it is in use by another process". Nothing else is
accessing this database. Is there something else that must be done when
working in WAL mode or when accessing from multiple threads as it has only
started having this problem since I changed to having multiple reader
threads and one write thread.

Many Thanks in advance

On 22 January 2018 at 09:37, Hannah Massey <hannah.bea...@gmail.com> wrote:

> ok thanks. So looks like I'm going to try WAL mode with one connection to
> the database per thread and accessing the database using
> SQLITE_OPEN_NOMUTEX., no shared-cache mode, no pragma read_uncommitted.
> Thanks for the advice.
>
> On 20 January 2018 at 19:49, Dan Kennedy <danielk1...@gmail.com> wrote:
>
>> On 01/19/2018 11:26 PM, Hannah Massey wrote:
>>
>>> Currently we access a single SQLite database in a single thread but I am
>>> working on changing this as performance has become a real problem. We
>>> will
>>> be using WAL mode and there will be one thread for writes and multiple
>>> threads for reads. For many cases, speed will be of a priority and it
>>> will
>>> not matter if the data returned from a read is slightly out of date so I
>>> can considering using #pragma uncommitted in some of the reader threads.
>>> Will #pragma uncommitted work in WAL mode and will it have the effect I'm
>>> looking for (where the read will be faster because it can ignore the
>>> recently written information in the WAL File) and simply use the database
>>> file only?
>>>
>>
>> Don't use "PRAGMA read_uncommitted". It is a no-op unless you turn on
>> shared-cache mode. And using shared-cache mode reduces the concurrency
>> provided by using wal mode.
>>
>> Dan.
>>
>>
>>
>> _______________________________________________
>> 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