SQLite PRAGMA

PRAGMA mmap_size

Query or change the maximum number of bytes that are set aside for memory-mapped I/O on a single database.

PRAGMA schema.mmap_size;
PRAGMA schema.mmap_size=N

On the sample database

What PRAGMA mmap_size returns on the sample database, in SQLite 3.54.1 as built for the browser by sql.js:

mmap_size
0

What the SQLite documentation says

Query or change the maximum number of bytes that are set aside for memory-mapped I/O on a single database. The first form (without an argument) queries the current limit. The second form (with a numeric argument) sets the limit for the specified database, or for all databases if the optional database name is omitted. In the second form, if the database name is omitted, the limit that is set becomes the default limit for all databases that are added to the database connection by subsequent ATTACH statements.

The argument N is the maximum number of bytes of the database file that will be accessed using memory-mapped I/O. If N is zero then memory mapped I/O is disabled. If N is negative, then the limit reverts to the default value determined by the most recent sqlite3_config(SQLITE_CONFIG_MMAP_SIZE), or to the compile time default determined by SQLITE_DEFAULT_MMAP_SIZE if no start-time limit has been set.

The PRAGMA mmap_size statement will never increase the amount of address space used for memory-mapped I/O above the hard limit set by the SQLITE_MAX_MMAP_SIZE compile-time option, nor the hard limit set at startup-time by the second argument to sqlite3_config(SQLITE_CONFIG_MMAP_SIZE)

The size of the memory-mapped I/O region cannot be changed while the memory-mapped I/O region is in active use, to avoid unmapping memory out from under running SQL statements. For this reason, the mmap_size pragma may be a no-op if the prior mmap_size is non-zero and there are other SQL statements running concurrently on the same database connection.

From sqlite.org's pragma documentation for SQLite 3.54.1, in the public domain.

← max_page_count · module_list →