2024-07-02 12:15:59 +00:00
|
|
|
-- Tags: no-object-storage, no-parallel, no-fasttest
|
|
|
|
-- no-object-storage: s3 has 20 more threads
|
2023-02-27 06:10:02 +00:00
|
|
|
-- no-parallel: it checks the number of threads, which can be lowered in presence of other queries
|
2022-07-03 06:24:09 +00:00
|
|
|
|
2022-07-02 16:49:41 +00:00
|
|
|
-- avoid settings randomization by clickhouse-test
|
2024-07-08 12:57:40 +00:00
|
|
|
set max_threads = 10;
|
|
|
|
|
|
|
|
-- more blocks to process
|
|
|
|
set max_block_size = 10;
|
|
|
|
set min_insert_block_size_rows = 10;
|
2022-07-02 16:49:41 +00:00
|
|
|
|
2024-07-11 16:00:32 +00:00
|
|
|
set materialized_views_ignore_errors = 1;
|
|
|
|
|
2022-07-02 16:49:41 +00:00
|
|
|
drop table if exists testX;
|
|
|
|
drop table if exists testXA;
|
|
|
|
drop table if exists testXB;
|
|
|
|
drop table if exists testXC;
|
|
|
|
|
|
|
|
create table testX (A Int64) engine=MergeTree order by tuple();
|
|
|
|
|
2024-07-08 12:57:40 +00:00
|
|
|
create materialized view testXA engine=MergeTree order by tuple() as select sleep(0.1) from testX;
|
|
|
|
create materialized view testXB engine=MergeTree order by tuple() as select sleep(0.2), throwIf(A=1) from testX;
|
|
|
|
create materialized view testXC engine=MergeTree order by tuple() as select sleep(0.1) from testX;
|
2022-07-02 16:49:41 +00:00
|
|
|
|
2024-07-11 16:00:32 +00:00
|
|
|
|
|
|
|
{% set count = namespace(value=0) %}
|
|
|
|
|
2022-07-02 16:49:41 +00:00
|
|
|
-- { echoOn }
|
|
|
|
{% for parallel_view_processing in [0, 1] %}
|
|
|
|
{% for optimize_trivial_insert_select in [0, 1] %}
|
2024-07-08 12:57:40 +00:00
|
|
|
{% for max_insert_threads in [0, 5] %}
|
2024-07-11 16:00:32 +00:00
|
|
|
|
|
|
|
{% set count.value = count.value + 1 %}
|
|
|
|
|
|
|
|
select 'optimize_trivial_insert_select={{ optimize_trivial_insert_select }}', 'max_insert_threads={{ max_insert_threads }}', 'iteration_num={{ iteration_num }}';
|
2022-07-02 16:49:41 +00:00
|
|
|
|
2024-07-08 12:57:40 +00:00
|
|
|
insert into testX select number from numbers(200) settings
|
2024-07-11 16:00:32 +00:00
|
|
|
send_logs_level='fatal',
|
|
|
|
insert_deduplication_token='UT_{{ count.value }}',
|
2022-07-02 16:49:41 +00:00
|
|
|
log_queries=1,
|
|
|
|
parallel_view_processing={{ parallel_view_processing }},
|
|
|
|
optimize_trivial_insert_select={{ optimize_trivial_insert_select }},
|
2024-07-11 16:00:32 +00:00
|
|
|
max_insert_threads={{ max_insert_threads }};
|
2022-07-02 16:49:41 +00:00
|
|
|
system flush logs;
|
2024-07-08 12:57:40 +00:00
|
|
|
select peak_threads_usage from system.query_log where
|
2022-07-02 16:49:41 +00:00
|
|
|
current_database = currentDatabase() and
|
|
|
|
type != 'QueryStart' and
|
|
|
|
query like '%insert into testX %' and
|
|
|
|
Settings['parallel_view_processing'] = '{{ parallel_view_processing }}' and
|
|
|
|
Settings['optimize_trivial_insert_select'] = '{{ optimize_trivial_insert_select }}' and
|
|
|
|
Settings['max_insert_threads'] = '{{ max_insert_threads }}';
|
|
|
|
|
|
|
|
select count() from testX;
|
|
|
|
select count() from testXA;
|
|
|
|
select count() from testXC;
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
-- { echoOff }
|
|
|
|
|
|
|
|
drop table testX;
|
|
|
|
drop view testXA;
|
|
|
|
drop view testXB;
|
|
|
|
drop view testXC;
|