Remix.run Logo
tnodir 4 hours ago

> PRAGMA synchronous = NORMAL;

> In NORMAL mode, the database engine syncs to disk only at critical moments (e.g., during checkpoints) rather than at every single transaction commit. In WAL mode, this is completely safe from database corruption; even if the server crashes, only the uncommitted transactions in the WAL are lost, but the database integrity remains intact.

No, this is not safe. You can lose the latest committed transaction with this pragma.

JSR_FDED 3 hours ago | parent | next [-]

Safe in this context means not corrupting the database. You might lose data, but the database will live on happily as if the missing data was never written to it. You don’t get half-committed transactions, and the database isn’t in a weird state.

tnodir 3 hours ago | parent [-]

> even if the server crashes, only the uncommitted transactions in the WAL are lost

I'm mainly referring to this quote.

So, you can lose committed transactions too.

lazyant 3 hours ago | parent | prev [-]

I lost rows in a busy table until I changed to PRAGMA synchronous = FULL