Description
As Sitaram Vemulapalli proposed, if the index provides a partial sort, we can use the index order to prune the sort size.
CREATE INDEX ON docs(a);
|
|
SELECT *
|
FROM docs
|
ORDER BY a, b
|
LIMIT 100;
|
The index does not fully sort the result. But after 100 records and a subsequent change in the value of a, we can abort the index scan and eliminate the remaining records.
Attachments
For Gerrit Dashboard: MB-20895 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
164582,31 | MB-20895 Prune sort with partial index order. | master | query | Status: MERGED | +2 | +1 |