Name
page_size — Set the size of a database page
Common Usage
PRAGMA [database
.]page_size; PRAGMA [database
.]page_size =bytes
;
Description
The page_size
pragma gets or sets the size of the
database pages. The
size must be a power of two. By default, the allowed
sizes are 512, 1024, 2048, 4096, 8192, 16384, and 32768 bytes.
This value becomes fixed once the database is initialized. The
only way to alter the page size on an existing database is to
set the page size and then immediately bytes
VACUUM
the database.
The default page size is calculated
from a number of factors. The default page size starts at 1024
bytes. If the datatype driver indicates that the native I/O
block of the filesystem is larger, that larger value will be
used up to the maximum default size, which is normally set to
8192. These values can be altered
with the SQLITE_DEFAULT_PAGE_SIZE
, SQLITE_
MAX_
DEFAULT_
PAGE_
SIZE
, and SQLITE_MAX_PAGE_SIZE
compiler-time directives.
The end result is that the page size for file-based databases will typically be between 1 KB and 4 KB on Microsoft Windows, and 1 KB on most other systems, including Mac OS X, Linux, and other Unix systems.
See Also
Get Using SQLite now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.