'Clickhouse: Should i optimize MergeTree table manually?

I have a table like:

create table test (id String, timestamp DateTime, somestring String) ENGINE = MergeTree ORDER BY (id, timestamp)

i inserted 100 records then inserted another 100 records and i run select query select * from test clickhouse returning with 2 parts their lengths are 100 and they are ordered in themselves. Then i run the query optimize table test and it started to return with 1 part and its length is 200 and ordered. So should i run optimize query after all insert and does it increase select query performance like select count(*) from test where id = 'foo' ?



Solution 1:[1]

Usually not, you can rely on Clickhouse background merges.

Also, Clickhouse has no intention to merge all the data from the partition into one part file, because "over-optimization" can affect performance too

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrei Koch