[sqlite] howto shrink files in wal mode

2015-05-07 Thread Dan Kennedy
On 05/07/2015 04:46 PM, Zaumseil Ren? wrote: >> How are you measuring the size of the database file ? >> >> Simon. > Using the tcl "file" command. > > puts b=[file size $dbfile] > > Please see in the script in the original post. If you do the VACUUM before the "PRAGMA wal_checkpoint" instead of

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Zaumseil René
>If you do the VACUUM before the "PRAGMA wal_checkpoint" instead of after, does >that help? > >Dan. You won the jackpot! Thank you for the tip. May be this should be mentioned in the official documentation. >I think the file actually has shrunk. I just think that the size reported is >not

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Simon Slavin
On 7 May 2015, at 11:25am, Zaumseil Ren? wrote: > But my problem remains :( If I do the script step by step I also do not see > the file shrink in the file explorer. > The dbfile will only shrink "after" I close the db connection. Even with an > explicit "vacuum" command. > > So the question

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Simon Slavin
> On 7 May 2015, at 10:46am, Zaumseil Ren? wrote: > >> How are you measuring the size of the database file ? > > Using the tcl "file" command. > > puts b=[file size $dbfile] I think tcl gets its file size from the operating system and the operating system doesn't update the size of flies

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Simon Slavin
On 7 May 2015, at 10:12am, Zaumseil Ren? wrote: > I have done "vacuum" right before the b= output. > > But the dbfile will only shrink "after" I have closed the db. How are you measuring the size of the database file ? Simon.

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Zaumseil René
> I think tcl gets its file size from the operating system and the operating > system doesn't update the size of flies with open > handles. But you are going to need someone who knows tcl to check that. I think that would be me :) > > Please see in the script in the original post. > > I'm

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Simon Slavin
On 7 May 2015, at 9:53am, Zaumseil Ren? wrote: > To clarify, I need to shrink the dbfile, not the *wal file. The only thing that will do that under your conditions is VACUUM. Simon.

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Zaumseil René
>How are you measuring the size of the database file ? > >Simon. Using the tcl "file" command. puts b=[file size $dbfile] Please see in the script in the original post. Rene Kernkraftwerk Goesgen-Daeniken AG CH-4658 Daeniken, Switzerland Diese Nachricht (inkl. Anhaenge) beinhaltet

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Zaumseil René
> > To clarify, I need to shrink the dbfile, not the *wal file. > The only thing that will do that under your conditions is VACUUM. > > Simon. I have done "vacuum" right before the b= output. But the dbfile will only shrink "after" I have closed the db. When I try the same in "DELETE" mode

[sqlite] howto shrink files in wal mode

2015-05-07 Thread Zaumseil René
> On 5/5/15, Zaumseil Ren? mailto:RZaumseil at kkg.ch>> > wrote: > > > > Is there a way to shrink the file when it is still open in WAL mode? > > > > Run "PRAGMA wal_checkpoint=TRUNCATE;" in SQLite 3.8.8.2 or later. > -- > D. Richard Hipp > drh at sqlite.org

[sqlite] howto shrink files in wal mode

2015-05-05 Thread Zaumseil René
Hi, After running the following script in sqlite 3.8.7.1: set dbfile {c:/temp/db.sqlite3} file delete -force $dbfile sqlite3 ::db $dbfile ::db eval { PRAGMA journal_mode = WAL; create table test2 (id, txt) } for {set i 0} {$i < 1} {incr i} { set t txt$i ::db eval {insert into test2

[sqlite] howto shrink files in wal mode

2015-05-05 Thread Richard Hipp
On 5/5/15, Zaumseil Ren? wrote: > > Is there a way to shrink the file when it is still open in WAL mode? > Run "PRAGMA wal_checkpoint=TRUNCATE;" in SQLite 3.8.8.2 or later. -- D. Richard Hipp drh at sqlite.org