如果我有一个表,其中结构更新(即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
在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
- 群集的称号。
在一般情况下:改变底层表后,您需要重新创建(或改变)分布式表。