Post

The new OPFSWriteAheadVFS for wa-sqlite not only brings concurrent reads to SQLite on the web, but also makes write transactions faster!

0 reposts1 like

It does this by not insisting every commit hit the disk immediately. Instead of updating the main database file right away, it writes changes into side log files first. That is cheaper, so small write transactions finish much faster.

In default mode, commit means "this transaction is recorded in WAL and the database stays valid," not "the browser has definitely flushed this to storage." If the tab crashes or the device loses power, the app may lose the most recent writes, but the database should not come back corrupted.

Why the speedup is big: forcing storage flush on every tiny write is expensive. That flush is often the slowest part of the commit. By skipping it on a hot path, the VFS removes a lot of overhead, which especially helps with workloads with many small transactions.