mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-06 07:32:27 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
19 lines
732 B
SQL
19 lines
732 B
SQL
DROP TABLE IF EXISTS collapsing;
|
|
|
|
CREATE TABLE collapsing(key String, value String, sign Int8) ENGINE CollapsingMergeTree(sign)
|
|
ORDER BY key
|
|
SETTINGS enable_vertical_merge_algorithm=1,
|
|
vertical_merge_algorithm_min_rows_to_activate=0,
|
|
vertical_merge_algorithm_min_columns_to_activate=0;
|
|
|
|
INSERT INTO collapsing VALUES ('k1', 'k1v1', 1);
|
|
INSERT INTO collapsing VALUES ('k1', 'k1v1', -1), ('k1', 'k1v2', 1);
|
|
INSERT INTO collapsing VALUES ('k2', 'k2v1', 1), ('k2', 'k2v1', -1), ('k3', 'k3v1', 1);
|
|
INSERT INTO collapsing VALUES ('k4', 'k4v1', -1), ('k4', 'k4v2', 1), ('k4', 'k4v2', -1);
|
|
|
|
OPTIMIZE TABLE collapsing PARTITION tuple() FINAL;
|
|
|
|
SELECT * FROM collapsing ORDER BY key;
|
|
|
|
DROP TABLE collapsing;
|