Closed sinmetal closed 5 years ago
Set the value of the last row of the query to WHERE and throw the query
SELECT * FROM Order1M@{FORCE_INDEX=Order1MCreatedAtDesc} ORDER BY CreatedAt DESC, OrderId LIMIT 10
Last Row
OrderId = “b28e0a2d-f131-497b-8eb3-71d5cdeddcf0”
CreatedAt = “2018-08-26T16:15:09.436784119Z”
SELECT *
FROM Order1M@{FORCE_INDEX=Order1MCreatedAtDesc}
WHERE
(CreatedAt < "2018-08-26T16:15:09.436784119Z")
OR (CreatedAt = "2018-08-26T16:15:09.436784119Z" AND OrderId > "b28e0a2d-f131-497b-8eb3-71d5cdeddcf0")
ORDER BY CreatedAt DESC, OrderId LIMIT 10
SpannerでCursorを実装するのは難しい。 TimestampベースでPaginationするなら、上記のやり方がベター
WHAT
I want a Cursor when executing a query
WHY
Cursor makes implementation easier for Pagenation.