Store extra columns for index-only scans.
Section: Create index patterns
PostgreSQL covering index with INCLUDE
sql
sql
CREATE INDEX idx_orders_status_created_at_inc ON orders (status, created_at DESC) INCLUDE (total_amount, user_id);Explanation
`INCLUDE` can help PostgreSQL serve some queries directly from the index when conditions are right.
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 index patterns