SQLite Forum

after crash loosing all records in a multi-GB table
Login
With "`synchronous=OFF`", "writes" to the database file are not really
writes, they are just moving the content into kernel space and then asking
the kernel to relay the content onto disk at its convenience.  If the OS
crashes before that happens, the data is lost, because it never reached
persistent storage.  I'm not sure there is anything you can do about that,
other than avoiding the use of "synchronous=OFF".

Have you tried "PRAGMA journal_mode=WAL;" with "PRAGMA synchronous=NORMAL;"?
That combination of options might work better for you.