pgref.dev/sqlite/errors/SQLITE_WARNING_AUTOINDEX
SQLITE_WARNING_AUTOINDEXWARNINGTier 1 — Safe⚠️ MEDIUM confidence

Query using automatic index (log warning)

Category: PerformanceVersions: 3.7.15+

🔴 Production Risk Error

Low — performance warning; queries still return correct results but may be slow.

What this means

SQLITE_WARNING_AUTOINDEX (284) is passed to the sqlite3_log() callback when the query planner creates an automatic index to satisfy a join or WHERE clause. It is a performance warning, not an error.

Why it happens

  1. 1JOIN or WHERE clause on a column with no index.
  2. 2Subquery result used as a join source without an index.

How to reproduce

Query execution when the planner decides to create a transient automatic index.

trigger — this will ERROR
-- Trigger automatic index:
CREATE TABLE a(x); CREATE TABLE b(x);
INSERT INTO a VALUES(1),(2),(3);
INSERT INTO b VALUES(2),(3),(4);
-- No index on b.x:
SELECT * FROM a JOIN b ON a.x = b.x;
-- Log: "automatic index on b(x)"
Log warning: "automatic index on b(x)"

Fix 1

Why this works

Add an index on the join or filter column: CREATE INDEX idx_b_x ON b(x);

Fix 2

Why this works

Use EXPLAIN QUERY PLAN to identify all automatic indexes in the query.

Sources

📚 Official docs: https://www.sqlite.org/rescode.html#warning_autoindex

🔧 Source ref: sqlite3.h — SQLITE_WARNING_AUTOINDEX = 284

📖 Further reading: Automatic indexes

Confidence assessment

⚠️ MEDIUM confidence

Stable.

See also

📄 Reference pages

Automatic indexesEXPLAIN QUERY PLAN
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →