SQLITE_WARNING_AUTOINDEX
SQLiteWARNINGCommonPerformanceofficial confidence

Query using automatic index (log warning)

Production Risk

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 — 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)"

expected output

Log warning: "automatic index on b(x)"

Fix 1

Fix 2

Sources
Official documentation ↗

sqlite3.h — SQLITE_WARNING_AUTOINDEX = 284

Automatic indexes

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All SQLite errors