Index multiple columns together.
Section: Constraints and Indexes
Create composite index
sql
sql
CREATE INDEX idx_orders_customer_created
ON orders (customer_id, created_at);Explanation
Column order matters in composite indexes.
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 Constraints and Indexes