-- { echoOn } -- explain pipeline select a from remote(test_cluster_two_shards, currentDatabase(), t) group by a; (Expression) ExpressionTransform × 4 (MergingAggregated) MergingAggregatedBucketTransform × 4 Resize 1 → 4 FinishAggregatingInOrderTransform 2 → 1 (Union) (Aggregating) SortingAggregatedForMemoryBoundMergingTransform 4 → 1 MergingAggregatedBucketTransform × 4 Resize 1 → 4 FinishAggregatingInOrderTransform 4 → 1 AggregatingInOrderTransform × 4 (Expression) ExpressionTransform × 4 (ReadFromMergeTree) MergeTreeInOrder × 4 0 → 1 (ReadFromRemote) select a from remote(test_cluster_two_shards, currentDatabase(), t) group by a order by a limit 5 offset 100500; 100500 100501 100502 100503 100504 explain pipeline select a from remote(test_cluster_two_shards, currentDatabase(), dist_t) group by a; (Expression) ExpressionTransform × 4 (MergingAggregated) MergingAggregatedBucketTransform × 4 Resize 1 → 4 FinishAggregatingInOrderTransform 2 → 1 (Union) (MergingAggregated) SortingAggregatedForMemoryBoundMergingTransform 4 → 1 MergingAggregatedBucketTransform × 4 Resize 1 → 4 FinishAggregatingInOrderTransform 2 → 1 (Union) (Aggregating) SortingAggregatedForMemoryBoundMergingTransform 4 → 1 MergingAggregatedBucketTransform × 4 Resize 1 → 4 FinishAggregatingInOrderTransform 4 → 1 AggregatingInOrderTransform × 4 (Expression) ExpressionTransform × 4 (ReadFromMergeTree) MergeTreeInOrder × 4 0 → 1 (ReadFromRemote) (ReadFromRemote) select a from remote(test_cluster_two_shards, currentDatabase(), dist_t) group by a order by a limit 5 offset 100500; 100500 100501 100502 100503 100504 1 -- { echoOn } -- explain pipeline select a, count() from dist_t_different_dbs group by a order by a limit 5 offset 500; (Expression) ExpressionTransform (Limit) Limit (Sorting) MergingSortedTransform 4 → 1 MergeSortingTransform × 4 LimitsCheckingTransform × 4 PartialSortingTransform × 4 (Expression) ExpressionTransform × 4 (MergingAggregated) MergingAggregatedBucketTransform × 4 Resize 1 → 4 FinishAggregatingInOrderTransform 2 → 1 (Union) (Aggregating) SortingAggregatedForMemoryBoundMergingTransform 4 → 1 MergingAggregatedBucketTransform × 4 Resize 1 → 4 FinishAggregatingInOrderTransform 4 → 1 AggregatingInOrderTransform × 4 (Expression) ExpressionTransform × 4 (ReadFromMergeTree) MergeTreeInOrder × 4 0 → 1 (ReadFromRemote) select a, count() from dist_t_different_dbs group by a order by a limit 5 offset 500; 500 2000 501 2000 502 2000 503 2000 504 2000 select a, count() from dist_t_different_dbs group by a, b order by a limit 5 offset 500; 500 2000 501 2000 502 2000 503 2000 504 2000 1000000 -- { echoOn } -- explain pipeline select a from pr_t group by a order by a limit 5 offset 500; (Expression) ExpressionTransform (Limit) Limit (Sorting) MergingSortedTransform 4 → 1 MergeSortingTransform × 4 LimitsCheckingTransform × 4 PartialSortingTransform × 4 (Expression) ExpressionTransform × 4 (MergingAggregated) Resize 1 → 4 SortingAggregatedTransform 4 → 1 MergingAggregatedBucketTransform × 4 Resize 1 → 4 GroupingAggregatedTransform 3 → 1 (Union) (ReadFromRemoteParallelReplicas) select a, count() from pr_t group by a order by a limit 5 offset 500; 500 1000 501 1000 502 1000 503 1000 504 1000 select a, count() from pr_t group by a, b order by a limit 5 offset 500; 500 1000 501 1000 502 1000 503 1000 504 1000