Section: SQLite index creation

Partial index

sql
sql
CREATE INDEX idx_tasks_open_due_at ON tasks (due_at) WHERE completed_at IS NULL;
Explanation

A smaller index can be more efficient when only open tasks matter to the hot path.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing SQLite index creation
Create an index
Add a basic lookup index.
OpenIn sheetsqlsame section
Expression index
Index a computed expression used in the query.
OpenIn sheetsqlsame section
Explain query plan
Inspect scans, searches, and covering-index use.
OpenIn sheetsql1 tag match
Analyze statistics
Populate or refresh planner statistics.
OpenIn sheetsql1 tag match
Use the .expert shell helper
Ask the SQLite shell for index advice.
OpenIn sheetbash1 tag match