I am using SQLite 3.5.7. This is a simplified example, but I have 2
threads in the same process, each with their own connection, and cache
sharing disabled.
Thread A does:
while (some condtion)
BEGIN IMMEDIATE
do some INSERTs
COMMIT
Thread B occasionally wants to also do its own BEGIN IMMEDIATE...COMMIT
I found that thread A tends to hog the database: thread B often times
out when attempting to begin its transaction. I added a sleep of 2
seconds at the bottom of thread A's loop, to give thread B a chance to
get in. That worked, but of course the throughput of thread A is
reduced as a result of the sleep calls, even when thread B doesn't
want to use the db.
Is there a better mechanism I should employ to ensure one writer
doesn't hog the database?
Thanks,
Dave
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users