1
votes

If I have a table, which structure was updated (ie system.query_log after latest update), but somehow distributed "view" has still old structure, how I could query data of new columns from that from entire cluster?

What I meant:

If you have distributed table, it could be done easily by:

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

But select Settings.names, Settings.values from distributed_query_log where event_date = '2019-01-24' limit 1\G will fail, because it does not have those fields, when system.query_log has:

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

2

2 Answers

3
votes

In Clickhouse release 1.1.54362 was added function cluster.

So, you can do it by:

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

Where CLUSTER_TITLE - your cluster's title.

Thanks: Alexander Bocharov

1
votes

In general case: after changing the underlying table you need to recreate (or alter) Distributed table.