1
create table main_table (number UInt64) engine = MergeTree order by tuple()
create table mt_1 (n UInt64, s String) engine = MergeTree order by tuple()
create table mt_2 (n UInt64, s String) engine = MergeTree order by tuple()
create table mt_3 (n UInt64, s String) engine = MergeTree order by tuple()
create table mt_4 (n UInt64, s String) engine = MergeTree order by tuple()
create materialized view mv_1 to mt_1 as
select number as n, toString(number) as s from main_table where number % 13 != 0
create materialized view mv_2 to mt_2 as
select number as n, toString(number) as s from main_table where number % 13 != 1
create materialized view mv_3 to mt_3 as
select number as n, toString(number) as s from main_table where number % 13 != 3
create materialized view mv_4 to mt_4 as
select number as n, toString(number) as s from main_table where number % 13 != 4
SYSTEM STOP MERGES main_table
SYSTEM STOP MERGES mt_1
SYSTEM STOP MERGES mt_2
SYSTEM STOP MERGES mt_3
SYSTEM STOP MERGES mt_4
insert into main_table select number from numbers(10000000)
drop table if exists mv_1
drop table if exists mv_2
drop table if exists mv_3
drop table if exists mv_4
drop table if exists main_table
drop table if exists mt_1
drop table if exists mt_2
drop table if exists mt_3
drop table if exists mt_4