create table
CREATE TABLE demo.replacemt (
key UInt32,
value UInt32
)
ENGINE = ReplacingMergeTree
ORDER BY key
insert data
INSERT INTO demo.replacemt values(1,1),(1,2),(2,1)
query data immediately
SELECT * FROM demo.replacemt
key | value |
---|---|
1 | 1 |
1 | 2 |
2 | 1 |
force optimizing
OPTIMIZE TABLE demo.replacemt FINAL
query data again
SELECT * FROM demo.replacemt
key | value |
---|---|
1 | 2 |
2 | 1 |