ClickHouse如何创建分布式表?

提问者:帅平 问题分类:大数据
ClickHouse如何创建分布式表?
1 个回答
国民小哥哥
国民小哥哥
首先创建本地表
CREATE TABLE test.table_local on cluster default_cluster
(
    `id` Int32,
    `uid` String,
    `name` String,
    `time` Int32,
    `create_at` DateTime
)
ENGINE = ReplicatedMergeTree()
PARTITION BY toYYYYMM(create_at)
ORDER BY id;

接着创建分布式表
CREATE TABLE test.table_local on cluster default_cluster
(
    `id` Int32,
    `uid` String,
    `name` String,
    `time` Int32,
    `create_at` DateTime
)
ENGINE = ReplicatedMergeTree()
PARTITION BY toYYYYMM(create_at)
ORDER BY id;
发布于:3个月前 (03-19) IP属地:未知
我来回答