按元组划分的 SummingMergeTree
SummingMergeTree partitioned by tuple
正在尝试创建按元组分区的 SummingMergeTree,如下所示:
CREATE TABLE partitioned_by_tuple(d Date, x UInt8, w String, y UInt8) ENGINE SummingMergeTree (y) PARTITION BY (d, x) ORDER BY (d, x, w);
正在 table 中插入数据:
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-02 │ 1 │ first │ 3 │
└────────────┴───┴───────┴───┘
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-01 │ 2 │ first │ 2 │
└────────────┴───┴───────┴───┘
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-01 │ 1 │ first │ 1 │
│ 2000-01-01 │ 1 │ first │ 2 │
└────────────┴───┴───────┴───┘
正在尝试优化 table:
OPTIMIZE TABLE partitioned_by_tuple;
并期望是这样的:
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-02 │ 1 │ first │ 3 │
└────────────┴───┴───────┴───┘
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-01 │ 2 │ first │ 2 │
└────────────┴───┴───────┴───┘
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-01 │ 1 │ first │ 3 │
└────────────┴───┴───────┴───┘
但是table优化后没有变化
我做错了什么?
根据https://clickhouse.yandex/docs/en/single/#optimize
If you specify FINAL, optimization will be performed even when all the data is already in one part.
您需要在末尾指定 FINAL
以强制在一个部分内执行优化。
编辑:
在这个 PR 之后 https://github.com/yandex/ClickHouse/pull/2599 OPTIMIZE 将能够使用 FINAL 来合并所有部分。
现在合并了。
正在尝试创建按元组分区的 SummingMergeTree,如下所示:
CREATE TABLE partitioned_by_tuple(d Date, x UInt8, w String, y UInt8) ENGINE SummingMergeTree (y) PARTITION BY (d, x) ORDER BY (d, x, w);
正在 table 中插入数据:
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-02 │ 1 │ first │ 3 │
└────────────┴───┴───────┴───┘
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-01 │ 2 │ first │ 2 │
└────────────┴───┴───────┴───┘
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-01 │ 1 │ first │ 1 │
│ 2000-01-01 │ 1 │ first │ 2 │
└────────────┴───┴───────┴───┘
正在尝试优化 table:
OPTIMIZE TABLE partitioned_by_tuple;
并期望是这样的:
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-02 │ 1 │ first │ 3 │
└────────────┴───┴───────┴───┘
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-01 │ 2 │ first │ 2 │
└────────────┴───┴───────┴───┘
┌──────────d─┬─x─┬─w─────┬─y─┐
│ 2000-01-01 │ 1 │ first │ 3 │
└────────────┴───┴───────┴───┘
但是table优化后没有变化
我做错了什么?
根据https://clickhouse.yandex/docs/en/single/#optimize
If you specify FINAL, optimization will be performed even when all the data is already in one part.
您需要在末尾指定 FINAL
以强制在一个部分内执行优化。
编辑:
在这个 PR 之后 https://github.com/yandex/ClickHouse/pull/2599 OPTIMIZE 将能够使用 FINAL 来合并所有部分。
现在合并了。