Re: [sqlite] transaction during reading on read-only database

2016-10-06 Thread Klaas Van B.
Ciao Andri,

To keep the results of a query consistent one better starts a transaction. A 
database can be updated by one thread at a time, but read by many.
Suppose you need a list of all employees of a department. If you start to 
search one at a time a lot of changes can happen. An employee can be moved to 
another department, fired or a new one entered. Another reason is speed. All 
(or most if it is a huge department and/or a tiny cache) employees are in cache 
so you're sure you have the requested list showing the situation on the moment 
of creation.

Andrii Motsok wrote Thu, 6 Oct 2016 11:43:10:

>My understanding is that any reading from database automatically starts read 
>transaction.
>The question: why does sqlite need to do it on read-only database?


Kind regards | Vriendelijke groeten | Cordiali saluti,
Klaas `Z4us` van Buiten V, Experienced Freelance ICT-Guy
https://www.linkedin.com/in/klaas-van-buiten-0325b2102
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] transaction during reading on read-only database

2016-10-06 Thread Dominique Pellé
Andrii Motsok  wrote:

> Hi,
>
>
> My understanding is that any reading from database automatically
> starts read transaction. The question: why does sqlite need to do it on 
> read-only database?
>
>
> Regards,
>
> Andrii

You may open a database as read-only, but another process can open it
as read-write.  So SQLite needs to check the lock even when the DB
is opened as read-only.

Now if the database is on a read-only file system, it is possible to
tell SQLite by
opening with file:foo.sqlite?immutable=1  (see https://www.sqlite.org/uri.html)
and that can save some time. But make sure to read the caveats at above URL.

Regards
Dominique
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] transaction during reading on read-only database

2016-10-06 Thread Andrii Motsok
Hi,


My understanding is that any reading from database automatically starts read 
transaction. The question: why does sqlite need to do it on read-only database?


Regards,

Andrii
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users