本文介绍了Clickhouse:选择时拆分输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Clickhouse上执行选择,在通过Materialized View从KafkaEngine表加载的MergeTree表上,一个简单的选择在 clickhouse-client 中以组的形式显示输出拆分:

Performing a select on Clickhouse, on a MergeTree table that is loaded from a KafkaEngine table via a Materialized View, a simple select shows output split in groups in the clickhouse-client:

:) select * from customersVisitors;
SELECT * FROM customersVisitors

┌────────day─┬─────────createdAt───┬──────────────────_id─┬───────────mSId─┬───────xId──┬─yId─┐
│ 2018-08-17 │ 2018-08-17 11:42:04 │  8761310857292948227 │ DV-1811114459  │ 846817     │ 0   │
│ 2018-08-17 │ 2018-08-17 11:42:04 │ 11444873433837702032 │ DV-2164132903  │ 780066     │ 0   │
└────────────┴─────────────────────┴──────────────────────┴────────────────┴────────────┴─────┘
┌────────day─┬─────────createdAt───┬──────────────────_id─┬───────────────────mSId──┬────────xId─┬─yId─┐
│ 2018-08-17 │ 2018-08-17 10:25:11 │ 14403835623731794748 │ DV-07680633204819271839 │ 307597     │ 0   │
└────────────┴─────────────────────┴──────────────────────┴─────────────────────────┴────────────┴─────┘

3 rows in set. Elapsed: 0.013 sec.

引擎是 ENGINE = MergeTree(day,(mSId,xId,day),8192)

为什么输出看起来分成两组?

Why does the output appear splitted in two groups?

推荐答案

如果我没记错的话,当数据来自不同的块时,输出将被拆分,通常还会导致在不同的线程中进行处理.如果要摆脱它,请将查询包装在外部选择中

If I'm not mistaken, the output is split when the data came from different blocks, also often it leads to being processed in different threads. If you want to get rid of it, wrap your query in outer select

select * from (...)

这篇关于Clickhouse:选择时拆分输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-19 03:14