Ummm....are we forgetting about WAL mode?

http://www.sqlite.org/draft/wal.html



"Reading and writing can proceed concurrently."



Not that you can have multiples of each...just one of each.







Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Advanced GEOINT Solutions Operating Unit
Northrop Grumman Information Systems

________________________________
From: [email protected] [[email protected]] on 
behalf of Simon Slavin [[email protected]]
Sent: Monday, July 16, 2012 6:24 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] set of db connections


On 16 Jul 2012, at 12:09pm, Durga D <[email protected]> wrote:

>    scenario: while write request is in progress with 100K records
> insertion, new request with reading of 10000 records already existing
> records. Here, read request should wait till write request completes. Is it
> correct?

You are correct.  In order to make the insertion of 100K records a single write 
request you will, of course, make it one transaction by enclosing it in BEGIN 
... COMMIT.

When one request (even one which reads and does not write) is in progress 
SQLite locks the entire database.  The read request will automatically know 
that it cannot execute until the write request is finished.  This will prevent 
any other requests from executing.  You should set a timeout value of a few 
seconds using

<http://www.sqlite.org/c3ref/busy_timeout.html>

to prevent the second request from simply returning a SQLITE_BUSY or 
SQLITE_LOCKED result.  With a timeout set, the read request will wait until the 
write request is finished (or the timeout has expired), and then execute.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to