mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 03:25:15 +00:00
be6777bc86
SELECTs are affected by the mutations, since it tries to apply them on fly, and scanning over existing mutations can take significant amount of time (for simple queries, i.e. count()) And also even after mutation had been finished, it still a problem, because mutations are not removed instantly. So instead introduce an atomic counter alter_conversions_mutations, that is incremented for new mutations and decremented once mutation finished/killed, that way once the mutation finished they will not affect queries. Here are some numbers for non-RENAME mutations: rmt vanilla w/o mutations | queries: 3693, QPS: 494.813 rmt vanilla w/ mutations | queries: 2190, QPS: 388.256 rmt patched w/o mutations | queries: 3168, QPS: 620.061 rmt patched w/ mutations | queries: 3155, QPS: 614.424 mt vanilla w/o mutations | queries: 3498, QPS: 656.399 mt vanilla w/ mutations | queries: 3821, QPS: 600.425 mt patched w/o mutations | queries: 5732, QPS: 745.585 mt patched w/ mutations | queries: 4719, QPS: 715.034 Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
35 lines
1.4 KiB
XML
35 lines
1.4 KiB
XML
<test>
|
|
<substitutions>
|
|
<substitution>
|
|
<name>engine</name>
|
|
<values>
|
|
<value>mt</value>
|
|
<value>rmt</value>
|
|
</values>
|
|
</substitution>
|
|
</substitutions>
|
|
|
|
<create_query>create table alter_select_mt (part_id String, col_0 String) engine=MergeTree() partition by part_id order by tuple() settings max_parts_to_merge_at_once=1</create_query>
|
|
<create_query>create table alter_select_rmt (part_id String, col_0 String) engine=ReplicatedMergeTree('/tables/{{database}}', '{{table}}') partition by part_id order by tuple() settings max_parts_to_merge_at_once=1</create_query>
|
|
|
|
<create_query>system stop merges alter_select_{engine}</create_query>
|
|
|
|
<fill_query>
|
|
insert into alter_select_{engine} (part_id, col_0)
|
|
select toString(number % 5000), 0 from numbers(10000)
|
|
settings
|
|
max_block_size=1,
|
|
max_insert_threads=32,
|
|
min_insert_block_size_rows=1,
|
|
insert_deduplicate=false,
|
|
parts_to_delay_insert=100000,
|
|
parts_to_throw_insert=100000
|
|
</fill_query>
|
|
<fill_query>alter table alter_select_{engine} drop column col_0 settings alter_sync = 0</fill_query>
|
|
|
|
<query>select count() from alter_select_{engine} format Null settings max_threads=1</query>
|
|
<query>select * from alter_select_{engine} format Null settings max_threads=1</query>
|
|
|
|
<drop_query>drop table alter_select_{engine}</drop_query>
|
|
</test>
|