2020-11-17 16:56:36 +00:00
|
|
|
SET optimize_on_insert = 0;
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS partitioned_by_tuple;
|
2018-07-05 17:32:14 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
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);
|
2018-07-05 17:32:14 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO partitioned_by_tuple VALUES ('2000-01-02', 1, 'first', 3);
|
|
|
|
INSERT INTO partitioned_by_tuple VALUES ('2000-01-01', 2, 'first', 2);
|
|
|
|
INSERT INTO partitioned_by_tuple VALUES ('2000-01-01', 1, 'first', 1), ('2000-01-01', 1, 'first', 2);
|
2018-07-05 17:32:14 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
OPTIMIZE TABLE partitioned_by_tuple;
|
2018-07-05 17:32:14 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM partitioned_by_tuple ORDER BY d, x, w, y;
|
2018-07-05 17:32:14 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
OPTIMIZE TABLE partitioned_by_tuple FINAL;
|
2018-07-05 17:32:14 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM partitioned_by_tuple ORDER BY d, x, w, y;
|
2018-07-05 17:32:14 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE partitioned_by_tuple;
|