0Pricing
PostgreSQL Performance & Query Optimization · Lesson

Composite and Covering Indexes

Speed up multi-column queries with composite indexes and eliminate table lookups entirely using covering indexes with INCLUDE.

Beyond Single-Column Indexes

Many queries filter on more than one column. A composite index spans multiple columns and can serve such queries far better than separate single-column indexes.

Creating a Composite Index

List columns in the order you want them indexed.

CREATE INDEX idx_orders_cust_date
ON orders (customer_id, order_date);

All lessons in this course

  1. B-Tree Indexes Fundamentals
  2. Creating and Using Indexes
  3. When and How to Index
  4. Composite and Covering Indexes
← Back to PostgreSQL Performance & Query Optimization