6 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
This article explains the new skip scan feature in PostgreSQL 18, which improves query performance by allowing the database to bypass unnecessary index entries. It details the setup process, how btree indexes work, and provides examples showing significant performance gains.
If you do, here's more
PostgreSQL 18 introduces a feature called "skip scans" designed to enhance query performance. This functionality allows the database to bypass irrelevant entries in an index, significantly reducing execution times for queries that involve composite indexes with a low variation of values in the leading column. For instance, if you're querying for "rare" values less than 10 while the "frequent" column contains mostly identical entries, traditional indexing would require scanning all the frequent values. Skip scans can jump directly to the relevant sections of the index, leading to considerable performance improvements.
In practical terms, a query that previously took 66 milliseconds to execute can drop to just 0.6 milliseconds with skip scans. This drastic reduction highlights the efficiency gained, especially in scenarios where the first indexed column has limited distinct values. However, for the skip scan feature to be effective, there must be enough redundancy in the first column; otherwise, the optimization loses its impact. This feature is automatically available to users with no need for additional configuration, making it a straightforward enhancement for those utilizing btree indexes.
Questions about this article
No questions yet.