Speed up frequent equality or range predicates.
Section: Index Strategy
Index a common lookup column
sql
sql
CREATE INDEX idx_users_email
ON users (email);Explanation
Index columns used heavily in WHERE, JOIN, and ORDER BY clauses.
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 Index Strategy
Avoid wrapping indexed columns in functions
Preserve index usability in predicates.
Use a covering index pattern
Create an index that supports filtering and ordering efficiently.
Use keyset pagination
Paginate by a stable cursor instead of a large OFFSET.
Explain with runtime stats
Run a query and collect timing or actual row information where supported.