Using Covering Indexes

Covering indexes refer to the definition of the index, where the index entries provide all needed data for a query. These are a specialized type of index since index entries here support specific queries.

Since you’ve likely got hundreds or thousands of queries, why bother with specific indexes for specific queries? The reason is that like multicolumn, covering indexes offer some of the best performance possible when plans include index-only scan operations. All needed data is provided by the index.

PostgreSQL version 11 added the INCLUDE[221] keyword, which can be used to create covering indexes.

The INCLUDE keyword specifies columns that only supply data, called “payload” columns. Payload columns cannot be used for ...

Get High Performance PostgreSQL for Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.