Section: SQLite index creation

Create an index

sql
sql
CREATE INDEX idx_notes_user_id_created_at ON notes (user_id, created_at DESC);
Explanation

A compact way to speed up per-user timelines or history screens.

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
Expression index
Index a computed expression used in the query.
OpenIn sheetsqlsame section
Partial index
Index only matching rows.
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