Enable the powersafe overwrite assumption.
This change improves performance on certain kinds of transactions
such as UPDATEs by allowing SQLite to make stronger assumptions
about data integrity on the disk.
The powersafe overwrite assumption demands that when a byte is
written to a file and a power event occurs then the only bytes
that may have been modified are the ones that were being written.
In absense of the powersafe overwrite assumption, SQLite assumes
that a write of any range of bytes within a disk sector may
potentially cause the rest of the sector to be corrupted. SQLite
needs to do extra work to compensate for this problem, which adds
overhead to certain transactions.
On flash devices, writing a byte causes the sector to be rewritten
somewhere else on the device. Eventually the old sector may be
erased and reused. The powersafe overwrite assumption therefore
holds as long as the flash device never leaves behind (observable)
half-written sectors in case of a power event. This is a fairly
safe assumption to make. Some flash devices apparently include
measures to ensure that the last write fully completes when
power is interrupted. In any case, the window of opportunity
for corruption to occur is very small.
Bug: 6484633
Change-Id: I0b0ef664b3a2a0e85c6099f0130d0affc5562be5
1 file changed