// sqlite · query planner

automatic_index

Let the planner build a temporary index for a join when none exists.

기본값
1 (on)
Range
0, 1
Restart needed
아니요
Default checked on
SQLite 3.5x

기능

The index lives only for one statement. If EXPLAIN QUERY PLAN shows 'AUTOMATIC COVERING INDEX' regularly, that is a hint to create the index permanently.

기본값

1 (on). On (a stock SQLite 3.5x build).

Check the current value

PRAGMA automatic_index;

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

Change it

PRAGMA automatic_index = OFF;   -- 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

Leave it on. Turn it off only to check whether a query depends on it.

What can go wrong

Off, joins without a usable index fall back to nested full scans.

Questions about automatic_index

What is the default value of automatic_index in SQLite?

1 (on). On (a stock SQLite 3.5x build).

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

Leave it on. Turn it off only to check whether a query depends on it.

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

// one client for every engine

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