mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Memory-mapped I/O is now on by default. The "PRAGMA mmap_limit(N)" can be
used to issue a hint to the VFS to limit mmap space to N bytes. The VFS is free to ignore that hint if desired. However, if "PRAGMA mmap_limit(0)" is used, xFetch is never called. FossilOrigin-Name: 1b37c4effdd03aa2ea938a71b4f22ed27391689b
This commit is contained in:
25
src/pragma.c
25
src/pragma.c
@@ -745,26 +745,23 @@ void sqlite3Pragma(
|
||||
}else
|
||||
|
||||
/*
|
||||
** PRAGMA [database.]mmap_size
|
||||
** PRAGMA [database.]mmap_size=N
|
||||
** PRAGMA [database.]mmap_limit(N)
|
||||
**
|
||||
** Used to set or query the mapping size limit. The mapping size limit is
|
||||
** Used to set mapping size limit. The mapping size limit is
|
||||
** used to limit the aggregate size of all memory mapped regions of the
|
||||
** database file. If this parameter is set to zero, then memory mapping
|
||||
** is not used at all. If it is set to a positive value, then it is
|
||||
** interpreted as a maximum size in pages. If set to less than zero, then
|
||||
** the absolute value is interpreted as a size limit in KB.
|
||||
** is not used at all. The parameter N is measured in bytes.
|
||||
**
|
||||
** The default value is zero (do not use memory mapped IO).
|
||||
** This value is advisory. The underlying VFS is free to memory map
|
||||
** as little or as much as it wants. Except, if N is set to 0 then the
|
||||
** upper layers will never invoke the xFetch interfaces to the VFS.
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft,"mmap_size")==0 ){
|
||||
if( sqlite3StrICmp(zLeft,"mmap_limit")==0 ){
|
||||
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
|
||||
if( !zRight ){
|
||||
returnSingleInt(pParse, "mmap_size", pDb->pSchema->mmap_size);
|
||||
}else{
|
||||
int size = sqlite3Atoi(zRight);
|
||||
pDb->pSchema->mmap_size = size;
|
||||
sqlite3BtreeSetMmapSize(pDb->pBt, pDb->pSchema->mmap_size);
|
||||
if( zRight ){
|
||||
sqlite3_int64 size;
|
||||
sqlite3Atoi64(zRight, &size, 1000, SQLITE_UTF8);
|
||||
sqlite3BtreeSetMmapLimit(pDb->pBt, size);
|
||||
}
|
||||
}else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user