Index a frequently filtered column.
Section: Create and use indexes
Create a basic index
sql
sql
CREATE INDEX idx_posts_user_id ON posts(user_id);Explanation
A simple index can dramatically reduce scan work on filters and joins.
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 Create and use indexes