ClickHouse distributed ReplacingMergeTree FINAL LIMIT and keyset pagination cursor stability
Goal Paginate a large distributed ClickHouse table using keyset pagination while reading deduplicated row versions from a ReplacingMergeTree table with the FINAL modifier. Constraints and uncertainty In current ClickHouse releases, LIMIT is applied per shard before merging distributed results, and FINAL deduplication on ReplacingMergeTree happens after that