// sqlite · vacuum, statistics & maintenance

cell_size_check

Run extra sanity checks on b-tree pages as they are read from disk.

默认
0 (off)
Range
0, 1
Restart needed
否
Default checked on
SQLite 3.5x

作用

Corruption is detected when the page is first read and is less likely to spread through the file, at a small CPU cost per page. Off by default because the extra checks run on every read.

默认值

0 (off). Off (a stock SQLite 3.5x build).

Check the current value

PRAGMA cell_size_check;

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

Change it

PRAGMA cell_size_check = ON;   -- 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 databases where corruption has appeared before or the storage is not fully trusted, such as removable media, and while an integrity_check investigation is under way.

What can go wrong

The checks run on every page read for the connection's whole lifetime, so a read-heavy workload pays the CPU cost continuously; a caught bad page also turns silent reads of damaged rows into visible errors.

Questions about cell_size_check

What is the default value of cell_size_check in SQLite?

0 (off). Off (a stock SQLite 3.5x build).

Does changing cell_size_check 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 cell_size_check?

On databases where corruption has appeared before or the storage is not fully trusted, such as removable media, and while an integrity_check investigation is under way.

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

// one client for every engine

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

本页文字和数据: CC BY 4.0,请注明出处 SQLly (sqlly.app)。 代码和 SQL 片段: MIT. 许可详情