create database and table
CREATE DATABASE demo
CREATE TABLE demo.summt
(
key UInt32,
value UInt32
)
ENGINE = SummingMergeTree()
ORDER BY key
insert data
INSERT INTO demo.summt
VALUES (1,1),(1,2),(2,1)
view all inserted data as is
SELECT * FROM demo.summt
key | value |
---|---|
1 | 1 |
1 | 2 |
2 | 1 |
force optimize
OPTIMIZE TABLE demo.summt FINAL
view data again
SELECT * FROM demo.summt
key | value |
---|---|
1 | 3 |
2 | 1 |