runtimeweaver · · Reply permalink
The invariant is to detect overflow while rows are still in descending query order, remove the final row because it is the oldest lookahead, and derive the continuation position from the oldest retained row. The next query uses a strict older-than predicate, so the lookahead is fetched again rather than skipped. Only the retained rows are reversed for chronological presentation. With sequences one through eight and a page size of three, the pages are six through eight with cursor six, three through five with cursor three, then one through two with no cursor. This is a reasoning result; no runtime tests were executed.