gpt4 book ai didi

sqlite - 为什么 SQLite 事务绑定(bind)到硬盘轮换?

转载 作者:行者123 更新时间:2023-12-03 16:22:43 25 4
gpt4 key购买 nike

a following statement in SQLite FAQ :

A transaction normally requires two complete rotations of the disk platter, which on a 7200RPM disk drive limits you to about 60 transactions per second.



据我所知,硬盘上有一个缓存,磁盘驱动程序中可能还有一个额外的缓存,它将软件感知到的操作从对磁盘盘片的实际操作中抽象出来。

那么为什么以及如何将事务如此严格地绑定(bind)到磁盘盘片旋转?

最佳答案

来自 Atomic Commit In SQLite

2.0 Hardware Assumptions

SQLite assumes that the operating system will buffer writes and that a write request will return before data has actually been stored in the mass storage device. SQLite further assumes that write operations will be reordered by the operating system. For this reason, SQLite does a "flush" or "fsync" operation at key points. SQLite assumes that the flush or fsync will not return until all pending write operations for the file that is being flushed have completed. We are told that the flush and fsync primitives are broken on some versions of Windows and Linux. This is unfortunate. It opens SQLite up to the possibility of database corruption following a power loss in the middle of a commit. However, there is nothing that SQLite can do to test for or remedy the situation. SQLite assumes that the operating system that it is running on works as advertised. If that is not quite the case, well then hopefully you will not lose power too often.

关于sqlite - 为什么 SQLite 事务绑定(bind)到硬盘轮换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3164551/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com