开发者

Does sqlite C\C++ library keep DB file as Memory-mapped file? and is it possible to make it do so?

开发者 https://www.devze.com 2023-03-28 00:40 出处:网络
So I wonder how sq开发者_高级运维lite C/C++ API keeps opened DB: does it use Memory-mapped file? Or how to make it do so?Yes, it does. Just search sqlite3.c for CreateFileMapping.By default, SQLite us

So I wonder how sq开发者_高级运维lite C/C++ API keeps opened DB: does it use Memory-mapped file? Or how to make it do so?


Yes, it does. Just search sqlite3.c for CreateFileMapping.


By default, SQLite uses memory mapping for shared memory file which only gets used in WAL journal mode. As per SQLite documentation https://sqlite.org/mmap.html, we can set PRAGMA mmap_size to force SQLite to use memory mapped file i/o in other modes as well. However, SQLite falls back to regular file i/o if it fails to map files in the memory.

0

精彩评论

暂无评论...
验证码 换一张
取 消