-- { echoOn } select 'optimize_trivial_insert_select=0', 'max_insert_threads=0', 'iteration_num='; optimize_trivial_insert_select=0 max_insert_threads=0 iteration_num= insert into testX select number from numbers(200) settings send_logs_level='fatal', insert_deduplication_token='UT_1', log_queries=1, parallel_view_processing=0, optimize_trivial_insert_select=0, max_insert_threads=0; system flush logs; select peak_threads_usage from system.query_log where current_database = currentDatabase() and type != 'QueryStart' and query like '%insert into testX %' and Settings['parallel_view_processing'] = '0' and Settings['optimize_trivial_insert_select'] = '0' and Settings['max_insert_threads'] = '0'; 2 select count() from testX; 200 select count() from testXA; 200 select count() from testXC; 200 select 'optimize_trivial_insert_select=0', 'max_insert_threads=5', 'iteration_num='; optimize_trivial_insert_select=0 max_insert_threads=5 iteration_num= insert into testX select number from numbers(200) settings send_logs_level='fatal', insert_deduplication_token='UT_2', log_queries=1, parallel_view_processing=0, optimize_trivial_insert_select=0, max_insert_threads=5; system flush logs; select peak_threads_usage from system.query_log where current_database = currentDatabase() and type != 'QueryStart' and query like '%insert into testX %' and Settings['parallel_view_processing'] = '0' and Settings['optimize_trivial_insert_select'] = '0' and Settings['max_insert_threads'] = '5'; 2 select count() from testX; 400 select count() from testXA; 400 select count() from testXC; 400 select 'optimize_trivial_insert_select=1', 'max_insert_threads=0', 'iteration_num='; optimize_trivial_insert_select=1 max_insert_threads=0 iteration_num= insert into testX select number from numbers(200) settings send_logs_level='fatal', insert_deduplication_token='UT_3', log_queries=1, parallel_view_processing=0, optimize_trivial_insert_select=1, max_insert_threads=0; system flush logs; select peak_threads_usage from system.query_log where current_database = currentDatabase() and type != 'QueryStart' and query like '%insert into testX %' and Settings['parallel_view_processing'] = '0' and Settings['optimize_trivial_insert_select'] = '1' and Settings['max_insert_threads'] = '0'; 2 select count() from testX; 600 select count() from testXA; 600 select count() from testXC; 600 select 'optimize_trivial_insert_select=1', 'max_insert_threads=5', 'iteration_num='; optimize_trivial_insert_select=1 max_insert_threads=5 iteration_num= insert into testX select number from numbers(200) settings send_logs_level='fatal', insert_deduplication_token='UT_4', log_queries=1, parallel_view_processing=0, optimize_trivial_insert_select=1, max_insert_threads=5; system flush logs; select peak_threads_usage from system.query_log where current_database = currentDatabase() and type != 'QueryStart' and query like '%insert into testX %' and Settings['parallel_view_processing'] = '0' and Settings['optimize_trivial_insert_select'] = '1' and Settings['max_insert_threads'] = '5'; 2 select count() from testX; 800 select count() from testXA; 800 select count() from testXC; 800 select 'optimize_trivial_insert_select=0', 'max_insert_threads=0', 'iteration_num='; optimize_trivial_insert_select=0 max_insert_threads=0 iteration_num= insert into testX select number from numbers(200) settings send_logs_level='fatal', insert_deduplication_token='UT_5', log_queries=1, parallel_view_processing=1, optimize_trivial_insert_select=0, max_insert_threads=0; system flush logs; select peak_threads_usage from system.query_log where current_database = currentDatabase() and type != 'QueryStart' and query like '%insert into testX %' and Settings['parallel_view_processing'] = '1' and Settings['optimize_trivial_insert_select'] = '0' and Settings['max_insert_threads'] = '0'; 5 select count() from testX; 1000 select count() from testXA; 1000 select count() from testXC; 1000 select 'optimize_trivial_insert_select=0', 'max_insert_threads=5', 'iteration_num='; optimize_trivial_insert_select=0 max_insert_threads=5 iteration_num= insert into testX select number from numbers(200) settings send_logs_level='fatal', insert_deduplication_token='UT_6', log_queries=1, parallel_view_processing=1, optimize_trivial_insert_select=0, max_insert_threads=5; system flush logs; select peak_threads_usage from system.query_log where current_database = currentDatabase() and type != 'QueryStart' and query like '%insert into testX %' and Settings['parallel_view_processing'] = '1' and Settings['optimize_trivial_insert_select'] = '0' and Settings['max_insert_threads'] = '5'; 12 select count() from testX; 1200 select count() from testXA; 1200 select count() from testXC; 1200 select 'optimize_trivial_insert_select=1', 'max_insert_threads=0', 'iteration_num='; optimize_trivial_insert_select=1 max_insert_threads=0 iteration_num= insert into testX select number from numbers(200) settings send_logs_level='fatal', insert_deduplication_token='UT_7', log_queries=1, parallel_view_processing=1, optimize_trivial_insert_select=1, max_insert_threads=0; system flush logs; select peak_threads_usage from system.query_log where current_database = currentDatabase() and type != 'QueryStart' and query like '%insert into testX %' and Settings['parallel_view_processing'] = '1' and Settings['optimize_trivial_insert_select'] = '1' and Settings['max_insert_threads'] = '0'; 2 select count() from testX; 1400 select count() from testXA; 1400 select count() from testXC; 1400 select 'optimize_trivial_insert_select=1', 'max_insert_threads=5', 'iteration_num='; optimize_trivial_insert_select=1 max_insert_threads=5 iteration_num= insert into testX select number from numbers(200) settings send_logs_level='fatal', insert_deduplication_token='UT_8', log_queries=1, parallel_view_processing=1, optimize_trivial_insert_select=1, max_insert_threads=5; system flush logs; select peak_threads_usage from system.query_log where current_database = currentDatabase() and type != 'QueryStart' and query like '%insert into testX %' and Settings['parallel_view_processing'] = '1' and Settings['optimize_trivial_insert_select'] = '1' and Settings['max_insert_threads'] = '5'; 7 select count() from testX; 1600 select count() from testXA; 1600 select count() from testXC; 1600