Clickhouse:从分布表中的数据

问题描述 投票:1回答:2

如果我有一个表,其中结构更新(即system.query_log最新更新后),但不知何故分布“视图”仍然具有旧的结构,我怎么可能从从整个集群查询新列的数据?

我的意思:

如果您有分布表,它可以很容易地通过完成:

select count(1) from distributed_query_log where event_date = '2019-01-24'

select Settings.names, Settings.values from distributed_query_log where event_date = '2019-01-24' limit 1\G会失败,因为它不具备这些领域,当system.query_log有:

select Settings.names, Settings.values from system.query_log where event_date = '2019-01-24' limit 1\G

distributed clickhouse
2个回答
2
投票

在Clickhouse发布1.1.54362加入功能cluster

所以,你可以做到这一点:

select Settings.names, Settings.values from cluster('CLUSTER_TITLE', 'system.query_log') where event_date = '2019-01-24' limit 1\G

CLUSTER_TITLE - 群集的称号。

感谢:Alexander Bocharov


1
投票

在一般情况下:改变底层表后,您需要重新创建(或改变)分布式表。

© www.soinside.com 2019 - 2024. All rights reserved.