// sqlite · disk i/o

page_size

Size of a database page in bytes.

기본값
4096
Range
Powers of two from 512 to 65536
Restart needed
아니요
Default checked on
SQLite 3.5x

기능

Fixed when the database file is first written. Changing it on an existing database needs VACUUM, and it cannot be changed while the database is in WAL mode.

기본값

4096. 4096 since SQLite 3.12.0 (1024 before).

Check the current value

PRAGMA page_size;

SELECT * FROM pragma_page_size;   -- table-valued form, usable in queries

Change it

PRAGMA page_size = 8192;
VACUUM;   -- needed for an existing database

No restart. The value is stored in the database file, but on an existing database it only takes effect after VACUUM rebuilds the file.

When to change it

Rarely. Larger pages can help databases that store large rows or blobs and are scanned sequentially.

What can go wrong

VACUUM rewrites the whole file and needs free disk space up to twice its size.

Questions about page_size

What is the default value of page_size in SQLite?

4096. 4096 since SQLite 3.12.0 (1024 before).

Does changing page_size require a restart?

No. No restart. The value is stored in the database file, but on an existing database it only takes effect after VACUUM rebuilds the file.

When should I change page_size?

Rarely. Larger pages can help databases that store large rows or blobs and are scanned sequentially.

Back to all SQLite settings, or check the SQLite manual for every option.

// one client for every engine

Check page_size 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.