2

I have SQLite database in WAL mode. Each time I perform a VACUUM on the database, the journal mode reverts to DELETE next time I reconnect.

For example:

PRAMGA journal_mode; -- returns wal
VACUUM;
PRAGMA journal_mode; -- returns wal
-- disconnect then reconnect
PRAGMA journal_mode; -- returns delete

Behaviour observed in SQLite 3.7 but appears to be fixed in 3.8.

Tamlyn
  • 22,122
  • 12
  • 111
  • 127
Polina
  • 75
  • 1
  • 1
  • 8

1 Answers1

1

The -wal file will be automatically deleted in certain situations where it's known to be empty, such as closing the DB when there are no other users. It will be automatically recreated when needed, on the next transaction.

The journal mode (as reported by PRAGMA journal_mode) should never change during this.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • 1
    This is what I have (pseudo code) `db.connect()` `db.execute("VACUUM;")` `db.disconnect()` db is initially in WAL mode. The weird thing that I see that after `disconnect()` is performed db switched to DELETE mode. After vacuum itself the db is still in WAL mode. I test it using `PRAGMA journal_mode`, not but presence of `-wal` file. – Polina Nov 19 '12 at 03:48