Even a read only database needs to create the wal journal if it doesn't
exist at the moment for a database that uses that mode:
https://www.sqlite.org/wal.html#read_only_databases

You might look into the immutable option mentioned there and see if it's
appropriate for your needs.


On Sun, Mar 24, 2019, 2:33 AM Thomas Kurz <sqlite.2...@t-net.ruhr> wrote:

> When I open a database in read-only mode (?mode=ro), I observe that the
> WAL and SHM temporary files are created anyway. Is there any possibility to
> prevent the creation of these files? Aren't they useless?
>
> Even worse (using sqlite3.exe version 3.27.1):
>
> .open test.db
> pragma journal_mode=wal;
> create table a (b integer);
> insert into a (1);
> .quit
>
> This creates database with WAL and SHM files; those files are correctly
> removed when exiting.
>
> .open --readonly test.db
> select * from a;       <--- creates WAL and SHM -- why?
> .quit
>
> Now, WAL and SHM files aren't deleted anymore.
>
> Proposal: Neither WAL nor SHM should be created at all when opening a
> WAL-mode database in read-only mode.
>
> _______________________________________________
> 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