LiteFS: Standard PRAGMA optimize usage?

Are there any gotchas with using LiteFS and PRAGMA statements, particularly PRAGMA optimize? I guess I’m wondering what sorts of PRAGMA things LiteFS does itself. For PRAGMA journal_mode I’m assuming LiteFS automatically sets WAL and that doesn’t have to happen manually?

The SQLite docs recommend this usage–

Applications with long-lived database connections should run “PRAGMA optimize=0x10002” when the database connection first opens, then run “PRAGMA optimize” again at periodic intervals - perhaps once per day. All applications should run “PRAGMA optimize” after schema changes, especially CREATE INDEX.

LiteFS will work with either the rollback journal or WAL so if you want to use the WAL then you’ll need to set it yourself. LiteFS performs physical replication so it works at the page level so most (if not all) the PRAGMA statements should work fine.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.