EXPLAIN QUERY PLAN (SQLite)
EXPLAIN QUERY PLAN (SQLite) is a SQL statement in the SQLite Specific category. SQLite: shows how a query is executed — which indexes are used, search strategy (SCAN vs SEARCH). The syntax is EXPLAIN QUERY PLAN SELECT ...;. It returns query execution plan. A typical example: EXPLAIN QUERY PLAN SELECT * FROM employees WHERE salary > 50000; -- |--SCAN TABLE employees -- Uses full table scan (no index on salary) -- After adding index: CREATE INDEX idx_salary ON employees(salary); EXPLAIN QUERY PLAN SELECT * FROM employees WHERE salary > 50000; -- |--SEARCH TABLE employees USING INDEX idx_salary -- Uses index for faster lookup A close relative is AUTOINCREMENT (SQLite), which sQLite: unlike AUTO_INCREMENT in MySQL, only INTEGER PRIMARY KEY columns auto-increment. AUTOINCREMENT guarantees unique increasing IDs. A close relative is ROWID / _ROWID_, which sQLite: every row has an implicit 64-bit ROWID. INTEGER PRIMARY KEY becomes an alias for ROWID.