max_page_count
Cap on how many pages the database file may hold, so it cannot grow past a size you choose.
- Standard
4294967294 pages- Range
- Current page count up to 4294967294
- Restart needed
- Nein
- Default checked on
- SQLite 3.5x
Was es bewirkt
A write that would push the file past the cap fails with SQLITE_FULL instead of consuming more disk. Each attached database gets its own cap, and the pragma will not set one below the file's current page count. With the default 4KB pages the stock cap allows a file of about 17.5TB.
Standardwert
4294967294 pages. 4294967294 (2^32-2) since SQLite 3.45.0; 1073741823 before that. With 4KB pages the cap is about 17.5TB.
Check the current value
PRAGMA max_page_count; SELECT * FROM pragma_max_page_count; -- table-valued form, usable in queries
Change it
PRAGMA max_page_count = 1073741824; -- 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
On volumes shared with other data, such as embedded devices or app-private folders, where one runaway database must not eat the last free disk space.
What can go wrong
Too low a cap fails inserts and updates with SQLITE_FULL, which reads like a full disk even when the volume has room; applications hitting it unexpectedly need the error surfaced clearly so the limit gets raised instead of disk space chased.
Questions about max_page_count
What is the default value of max_page_count in SQLite?
4294967294 pages. 4294967294 (2^32-2) since SQLite 3.45.0; 1073741823 before that. With 4KB pages the cap is about 17.5TB.
Does changing max_page_count 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 max_page_count?
On volumes shared with other data, such as embedded devices or app-private folders, where one runaway database must not eat the last free disk space.
Back to all SQLite settings, or check the SQLite manual for every option.
Check max_page_count 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.
Text und Daten auf dieser Seite: CC BY 4.0, Quelle: SQLly (sqlly.app). Code und SQL-Snippets: MIT. Lizenzdetails