Execute SYSTEM Statements on All Nodes in ClickHouse Cloud
Learn how to use `ON CLUSTER` and `clusterAllReplicas` to execute SYSTEM statements and queries across all nodes in a ClickHouse Cloud service.
Answer
In order to execute the same query on all nodes of a ClickHouse Cloud service, we can use clusterAllReplicas.
For example, in order to get entries from a (node-local) system table from all nodes, you can use:
Similarly, you can execute the same SYSTEM statement on all nodes with a single statement, by using the ON CLUSTER clause:
For example for dropping the filesystem cache from all nodes, you can use:
· One min read