On 16 Jul 2012, at 12:09pm, Durga D <durga.d...@gmail.com> 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
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to