DEV Community

Discussion on: Index Only Scan on Functional Indexes

Collapse
hunleyd profile image
Douglas J Hunley

That's not a covering index. A covering index allows a user to perform an index-only scan if the select list in the query matches the columns that are included in the index. You can specify the additional columns for the index using the "INCLUDE" keyword, e.g.

CREATE INDEX a_b_idx ON x (a,b) INCLUDE (c);

What you have is a multicolumn index.

Collapse
franckpachot profile image
Franck Pachot Author

Right, include is the one I wanted to put there and I'll update the post. Doesn't change the idea anyway as if you update the column you will move the entry anyway. Both are covering the projection and the query planner see it, that's the important point.