SQLite PRAGMA statements

Pragmas query and change SQLite's settings and internal state: page size, journal mode, foreign keys, integrity checks and more. Each page has the official description and, where it is safe to run, what the pragma returns on the sample database.

analysis_limitQuery or change a limit on the approximate ANALYZE setting.
application_idThe application_id PRAGMA is used to query or set the 32-bit signed big-endian "Application ID" integer located at…
auto_vacuumQuery or set the auto-vacuum status in the database.
automatic_indexQuery, set, or clear the automatic indexing capability.
busy_timeoutQuery or change the setting of the busy timeout.
cache_sizeQuery or change the suggested maximum number of database disk pages that SQLite will hold in memory at once per open…
cache_spillThe cache_spill pragma enables or disables the ability of the pager to spill dirty cache pages to the database file in…
case_sensitive_likeThe default behavior of the LIKE operator is to ignore case for ASCII characters. deprecated
cell_size_checkThe cell_size_check pragma enables or disables additional sanity checking on database b-tree pages as they are…
checkpoint_fullfsyncQuery or change the fullfsync flag for checkpoint operations.
collation_listReturn a list of the collating sequences defined for the current database connection.
compile_optionsThis pragma returns the names of compile-time options used when building SQLite, one option per row.
count_changesQuery or change the count-changes flag. deprecated
data_store_directoryQuery or change the value of the sqlite3_data_directory global variable, which windows operating-system interface… deprecated
data_versionThe "PRAGMA data_version" command provides an indication that the database file has been modified.
database_listThis pragma works like a query to return one row for each database attached to the current database connection.
default_cache_sizePRAGMA schema.default_cache_size; PRAGMA schema.default_cache_size = Number-of-pages; This pragma queries or sets the… deprecated
defer_foreign_keysWhen the defer_foreign_keys PRAGMA is on, enforcement of all foreign key constraints is delayed until the outermost…
empty_result_callbacksQuery or change the empty-result-callbacks flag. deprecated
encodingIn first form, if the main database has already been created, then this pragma returns the text encoding used by the…
foreign_key_checkThe foreign_key_check pragma checks the database, or the table called "table-name", for foreign key constraints that…
foreign_key_listThis pragma returns one row for each foreign key constraint created by a REFERENCES clause in the CREATE TABLE…
foreign_keysQuery, set, or clear the enforcement of foreign key constraints.
freelist_countReturn the number of unused pages in the database file.
full_column_namesQuery or change the full_column_names flag. deprecated
fullfsyncQuery or change the fullfsync flag.
function_listThis pragma returns a list of SQL functions known to the database connection.
hard_heap_limitThis pragma invokes the sqlite3_hard_heap_limit64() interface with the argument N, if N is specified and N is a…
ignore_check_constraintsThis pragma enables or disables the enforcement of CHECK constraints.
incremental_vacuumThe incremental_vacuum pragma causes up to N pages to be removed from the freelist.
index_infoThis pragma returns one row for each key column in the named index.
index_listThis pragma returns one row for each index associated with the given table.
index_xinfoThis pragma returns information about every column in an index.
integrity_checkThis pragma does a low-level formatting and consistency check of the database.
journal_modeThis pragma queries or sets the journal mode for databases associated with the current database connection.
journal_size_limitIf a database connection is operating in exclusive locking mode or in persistent journal mode (PRAGMA…
legacy_alter_tableThis pragma sets or queries the value of the legacy_alter_table flag.
legacy_file_formatThis pragma no longer functions.
locking_modeThis pragma sets or queries the database connection locking-mode.
max_page_countQuery or set the maximum number of pages in the database file.
mmap_sizeQuery or change the maximum number of bytes that are set aside for memory-mapped I/O on a single database.
module_listThis pragma returns a list of virtual table modules registered with the database connection.
optimizeAttempt to optimize the database.
page_countReturn the total number of pages in the database file.
page_sizeQuery or set the page size of the database.
parser_traceIf SQLite has been compiled with the SQLITE_DEBUG compile-time option, then the parser_trace pragma can be used to turn… only in builds with non-standard options
pragma_listThis pragma returns a list of PRAGMA commands known to the database connection.
query_onlyThe query_only pragma prevents data changes on database files when enabled.
quick_checkThe pragma is like integrity_check except that it does not verify UNIQUE constraints and does not verify that index…
read_uncommittedQuery, set, or clear READ UNCOMMITTED isolation.
recursive_triggersQuery, set, or clear the recursive trigger capability.
reverse_unordered_selectsWhen enabled, this PRAGMA causes many SELECT statements without an ORDER BY clause to emit their results in the reverse…
schema_versionThe schema_version pragma will get or set the value of the schema-version integer at offset 40 in the database header. for testing; not for applications
secure_deleteQuery or change the secure-delete setting.
short_column_namesQuery or change the short-column-names flag. deprecated
shrink_memoryThis pragma causes the database connection on which it is invoked to free up as much memory as it can, by calling…
soft_heap_limitThis pragma invokes the sqlite3_soft_heap_limit64() interface with the argument N, if N is specified and is a…
statsThis pragma returns auxiliary information about tables and indices. for testing; not for applications
synchronousQuery or change the setting of the "synchronous" flag.
table_infoThis pragma returns one row for each normal column in the named table.
table_listThis pragma returns information about the tables and views in the schema, one table per row of output.
table_xinfoThis pragma returns one row for each column in the named table, including generated columns and hidden columns.
temp_storeQuery or change the setting of the "temp_store" parameter.
temp_store_directoryQuery or change the value of the sqlite3_temp_directory global variable, which many operating-system interface backends… deprecated
threadsQuery or change the value of the sqlite3_limit(db,SQLITE_LIMIT_WORKER_THREADS,...) limit for the current database…
trusted_schemaThe trusted_schema setting is a per-connection boolean that determines whether or not SQL functions and virtual tables…
user_versionThe user_version pragma will get or set the value of the user-version integer at offset 60 in the database header.
vdbe_addoptraceIf SQLite has been compiled with the SQLITE_DEBUG compile-time option, then the vdbe_addoptrace pragma can be used to… only in builds with non-standard options
vdbe_debugIf SQLite has been compiled with the SQLITE_DEBUG compile-time option, then the vdbe_debug pragma is a shorthand for… only in builds with non-standard options
vdbe_listingIf SQLite has been compiled with the SQLITE_DEBUG compile-time option, then the vdbe_listing pragma can be used to… only in builds with non-standard options
vdbe_traceIf SQLite has been compiled with the SQLITE_DEBUG compile-time option, then the vdbe_trace pragma can be used to cause… only in builds with non-standard options
wal_autocheckpointThis pragma queries or sets the write-ahead log auto-checkpoint interval.
wal_checkpointIf the write-ahead log is enabled (via the journal_mode pragma), this pragma causes a checkpoint operation to run on…
writable_schemaWhen this pragma is on, and the SQLITE_DBCONFIG_DEFENSIVE flag is off, then the sqlite_schema table can be changed… for testing; not for applications