mmap_size
Bytes of the database file to access through memory-mapped I/O; 0 disables it.
- 默认
0 (off)- Range
- 0 up to SQLITE_MAX_MMAP_SIZE
- Restart needed
- 否
- Default checked on
- SQLite 3.5x
作用
Reads through the mapping skip a copy into the page cache. The value is capped by the compile-time SQLITE_MAX_MMAP_SIZE (the macOS system build reports 1GB).
默认值
0 (off). 0 (a stock SQLite 3.5x build).
Check the current value
PRAGMA mmap_size;
Change it
PRAGMA mmap_size = 268435456; -- this connection only
No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When to change it
Read-heavy applications on 64-bit systems where the database is up to a few hundred MB.
What can go wrong
An I/O error on a mapped page crashes the process (SIGBUS) instead of returning an error; some platforms handle mapped writes poorly.
Questions about mmap_size
What is the default value of mmap_size in SQLite?
0 (off). 0 (a stock SQLite 3.5x build).
Does changing mmap_size require a restart?
No. No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When should I change mmap_size?
Read-heavy applications on 64-bit systems where the database is up to a few hundred MB.
Back to all SQLite settings, or check the SQLite manual for every option.
Check mmap_size on your own server
SQLly runs the query above against SQLite and the other engines in this reference, from one desktop app on macOS, Windows and Linux.