SQLite PRAGMA

PRAGMA secure_delete

Query or change the secure-delete setting.

PRAGMA schema.secure_delete;
PRAGMA schema.secure_delete = boolean|FAST

On the sample database

What PRAGMA secure_delete returns on the sample database, in SQLite 3.54.1 as built for the browser by sql.js:

secure_delete
0

What the SQLite documentation says

Query or change the secure-delete setting. When secure_delete is on, SQLite overwrites deleted content with zeros. The default setting for secure_delete is determined by the SQLITE_SECURE_DELETE compile-time option and is normally off. The off setting for secure_delete improves performance by reducing the number of CPU cycles and the amount of disk I/O. Applications that wish to avoid leaving forensic traces after content is deleted or updated should enable the secure_delete pragma prior to performing the delete or update, or else run VACUUM after the delete or update.

The "fast" setting for secure_delete (added circa 2017-08-01) is an intermediate setting in between "on" and "off". When secure_delete is set to "fast", SQLite will overwrite deleted content with zeros only if doing so does not increase the amount of I/O. In other words, the "fast" setting uses more CPU cycles but does not use more I/O. This has the effect of purging all old content from b-tree pages, but leaving forensic traces on freelist pages.

When there are attached databases and no database is specified in the pragma, all databases have their secure-delete setting altered. The secure-delete setting for newly attached databases is the setting of the main database at the time the ATTACH command is evaluated.

When multiple database connections share the same cache, changing the secure-delete flag on one database connection changes it for them all.

Limitation: The secure_delete pragma only causes deleted content to be scrubbed from ordinary tables. If virtual tables store content in shadow tables, then deleting content from the virtual table does not necessarily remove forensic traces from the shadow tables. In particular, the FTS3 and FTS5 virtual tables that come bundled with SQLite might leave forensic traces in their shadow tables even if the secure_delete pragma is enabled.

From sqlite.org's pragma documentation for SQLite 3.54.1, in the public domain.

← schema_version · short_column_names →