views:

15

answers:

1

In the SQLite documentation on the write-ahead-log feature introduced in version 3.7, there are some comments which confused me a bit.

The linked page says "syncing the content to the disk is not required, as long as the application is willing to sacrifice durability following a power loss". Then a couple of paragraphs down, it says "Checkpointing does require sync operations in order to avoid the possibility of database corruption following a power loss or hard reboot"".

So is my database at greater risk of corruption on power loss if I use WAL?

+1  A: 

There is no increased risk of corruption with WAL (since it uses sync operations when checkpointing).

However, if there is a crash (power loss or hard reboot) you will lose any transactions since the last checkpoint; that's what is meant by "sacrificing durability."

Doug Currie