sqlite3 app.db 'CREATE INDEX idx_users_email ON users(email);'

Category: Databases & SQL

sqlite3 app.db 'CREATE INDEX idx_users_email ON users(email);'

Add an index on a column

Speeds up queries that filter or sort by email at the cost of slower writes and extra disk. Confirm the planner uses it with EXPLAIN QUERY PLAN. Related: .indexes.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.