soft_heap_limit
Advisory ceiling on the heap memory SQLite may use across every connection in the process.
- Predeterminado
0 (no limit)- Range
- 0 or more bytes
- Restart needed
- No
- Default checked on
- SQLite 3.5x
Lo que hace
The limit is process wide, not per connection. As usage climbs toward it, SQLite shrinks page caches to stay under. It is advisory: SQLite will cross the limit rather than fail a query with SQLITE_NOMEM. Setting 0 removes the limit; values that are not non-negative integers leave it unchanged.
Valor predeterminado
0 (no limit). 0 (a stock SQLite 3.5x build), meaning the limit is disabled.
Check the current value
PRAGMA soft_heap_limit; SELECT * FROM pragma_soft_heap_limit; -- table-valued form, usable in queries
Change it
PRAGMA soft_heap_limit = 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
In one process that hosts many connections on a memory-constrained device, to tell SQLite to give page-cache memory back as usage grows.
What can go wrong
It bends instead of holding: a query that genuinely needs the memory still gets it, so treat this as a hint for cache trimming. One connection's PRAGMA moves the ceiling for every connection in the process.
Questions about soft_heap_limit
What is the default value of soft_heap_limit in SQLite?
0 (no limit). 0 (a stock SQLite 3.5x build), meaning the limit is disabled.
Does changing soft_heap_limit 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 soft_heap_limit?
In one process that hosts many connections on a memory-constrained device, to tell SQLite to give page-cache memory back as usage grows.
Back to all SQLite settings, or check the SQLite manual for every option.
Related on SQLly
Check soft_heap_limit 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.
Texto y datos de esta página: CC BY 4.0, con atribución a SQLly (sqlly.app). Código y fragmentos SQL: MIT. Detalles de la licencia