vinyl: simplify iteration over ranges in read iterator
Historically, we have this 'belong_range/range_ended' optimization in the read iterator: we move to the next range iff all sources that are marked as 'belong_range' are done. It is supposed to spare us a comparison with a range boundary on each iteration. However, with the introduction of the tuple cache and the unified memory level, it became more of a pain in the ass rather than a valuable asset. Thanks to it, we have to read all runs that belong to the current range before we can jump to the next range, even if all statements spanned by the current range are in the cache. Also, when all runs in a range have been read, we immediately jump to the next range and read its runs, even if the user intends to stop the iterator after reading a memory statement that is within the current range. That said, we effectively trade disk accesses for simple in-memory comparison operations, which is silly. Let's get rid of this "optimization" and make iteration over ranges straightforward: after the merge iterator returns a statement, compare it to the current range boundary and jump to the next range if it is outside.
Loading
Please register or sign in to comment