mirror of
https://github.com/outbackdingo/clickhouse-cluster-example.git
synced 2026-01-27 02:18:28 +00:00
19 lines
525 B
SQL
19 lines
525 B
SQL
CREATE TABLE test
|
|
(
|
|
test_date DateTime,
|
|
random_int UInt32
|
|
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/test', '{replica}')
|
|
PARTITION BY toYYYYMM(test_date)
|
|
ORDER BY (test_date);
|
|
|
|
CREATE TABLE test_all (
|
|
test_date DateTime,
|
|
random_int UInt32
|
|
) ENGINE = Distributed('ck_cluster', 'default', 'test', random_int);
|
|
|
|
INSERT INTO test_all VALUES ('2020-01-01 01:01:01', 1);
|
|
INSERT INTO test_all VALUES ('2020-02-02 02:02:02', 2);
|
|
|
|
-- select * from system.clusters
|
|
-- select hostName(), * from test_all
|