On 15 August 2018 at 11:11, Edmund Horner <ejrh00@gmail.com> wrote:
So we'd extend that to: - Include in the OR-list "range" subquals of the form (ctid > ? AND ctid < ?) (either side could be optional, and we have to deal with >= and <= and having ctid on the rhs, etc.). - Cost the range subquals by assuming they don't overlap, and estimating how many blocks and tuples they span. - When beginning the scan, evaluate all the ?s and build an array of "tid ranges" to fetch. A tid range is a struct with a starting tid, and an ending tid, and might just be a single tid item. - Sort and remove duplicates. - Iterate over the array, using a single fetch for single-item tid ranges, and starting/ending a heap scan for multi-item tid ranges.
I think I'll try implementing this.
I've set this patch as waiting on author in the commitfest app.