Hacker News new | ask | show | jobs
by mdavidn 1610 days ago
Starting with PostgreSQL 11, B-tree indexes can store additional "non-key" columns in the index. These are kept in the index alongside the sorted key columns. This can avoid expensive sorts in certain query plans.

It's not perfect. Stale table statistics sometimes forces PostgreSQL to check table pages to confirm that rows are visible to the current transaction. Index-only scans don't support features like expressions either.

1 comments

Is there a way to get this behavior with the implicit index on the primary key?