Use included columns to support index-only reads for certain queries.
Section: High-value Query Performance Patterns
Covering index with INCLUDE
sql
sql
CREATE INDEX idx_orders_customer_created_inc
ON orders (customer_id, created_at DESC)
INCLUDE (status, total_amount);Explanation
See summary for usage details.
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 High-value Query Performance Patterns
Keyset pagination
Prefer keyset pagination over deep OFFSET scans for large result sets.
Select needed columns
Avoid fetching unnecessary columns, especially wide rows.
Batch updates
Chunk large writes into batches to reduce contention and WAL spikes.
Create range-partitioned table
Partition large time-series tables by range.