3 ms·
Well look how SQLite does write ahead logging (assuming I understand it). Transactions can go into the log and commit, without modifying the original data. Now
by MichaelGG 15y ago
Well look how SQLite does write ahead logging (assuming I understand it). Transactions can go into the log and commit, without modifying the original data. Now and then, it can "checkpoint" to move those logged transactions into the database. This way, transactions are mainly sequential writes, with a bit of maintenance now and then.
I've used a similar approach for a constant database. The transaction log goes to disk, but also stays in memory. Scanning it linearly isn't that slow. When it grows too large, the log is converted into a disk-optimized format, which is a rather quick process. This way, it can take tons of writes, service reads acceptably, while still being able to store much more data than RAM and offering fast access to on-disk data.
- ryanpetrich 15y agoI understand that to be the case when not using synchronous. The point of synchronous full is that sqlite should only consider a transaction committed when it is fully flushed to disk. Assuming a 7200rpm disk that isn't lying to you, at most 120 dependent transactions a second should be even possible. (this should apply equally to other databases that have a similar option)
- MichaelGG 15y agoWhy does the disk need to re-seek to write to the next sector? With things like SQLite WAL, you're just performing sequential writes to disk.
- ryanpetrich 15y agoI hadn't thought of that. If the disk can perform some localized remapping, it's possible to get sequential fsynced writes to exceed the rotation speed.