Description
A performance suggestion, based on unproven, rough reading of the code...
When doing an ORDER BY ... OFFSET x LIMIT y, a max-heap that can grow to size x+y is maintained. At the very end, a final sort.Sort() is performed on the collected items.
If that's the correct understanding, this might be optimized where instead of a final sorting of the items (which can have up to x+y number of entries), the max-heap can instead be Pop()'ed by y number of times to retrieve the sorted results.
Attachments
Issue Links
- relates to
-
MB-61760 Query with ORDER BY and only OFFSET clause returns wrong results when partial index order is used
- Closed
For Gerrit Dashboard: MB-33961 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
201686,9 | MB-33961 ORDER BY optimisation | master | query | Status: MERGED | +2 | +1 |