2021-09-12 12:35:27 +00:00
|
|
|
-- Tags: shard, no-parallel
|
|
|
|
|
2021-04-15 13:12:39 +00:00
|
|
|
create database if not exists shard_0;
|
|
|
|
create database if not exists shard_1;
|
|
|
|
drop table if exists shard_0.tbl;
|
|
|
|
drop table if exists shard_1.tbl;
|
2020-12-23 16:04:05 +00:00
|
|
|
drop table if exists distr;
|
|
|
|
|
2021-04-15 13:12:39 +00:00
|
|
|
create table shard_0.tbl (number UInt64) engine = MergeTree order by number;
|
|
|
|
create table shard_1.tbl (number UInt64) engine = MergeTree order by number;
|
|
|
|
create table distr (number UInt64) engine = Distributed(test_cluster_two_shards_different_databases, '', tbl);
|
2020-12-23 16:04:05 +00:00
|
|
|
|
|
|
|
set insert_distributed_sync = 1;
|
|
|
|
set insert_distributed_one_random_shard = 1;
|
2021-04-15 13:12:39 +00:00
|
|
|
set max_block_size = 1;
|
|
|
|
set max_insert_block_size = 1;
|
|
|
|
set min_insert_block_size_rows = 1;
|
2021-12-12 00:55:23 +00:00
|
|
|
insert into distr select number from numbers(100);
|
2021-04-15 13:12:39 +00:00
|
|
|
|
|
|
|
select count() != 0 from shard_0.tbl;
|
|
|
|
select count() != 0 from shard_1.tbl;
|
2021-12-12 00:55:23 +00:00
|
|
|
select * from distr order by number LIMIT 20;
|
2021-04-15 13:12:39 +00:00
|
|
|
|
|
|
|
drop table if exists shard_0.tbl;
|
|
|
|
drop table if exists shard_1.tbl;
|
|
|
|
drop database shard_0;
|
|
|
|
drop database shard_1;
|
|
|
|
drop table distr;
|