2021-09-12 12:35:27 +00:00
|
|
|
-- Tags: distributed
|
|
|
|
|
2022-02-11 14:15:56 +00:00
|
|
|
set allow_experimental_parallel_reading_from_replicas = 0;
|
|
|
|
|
2019-11-25 13:09:44 +00:00
|
|
|
drop table if exists sample_final;
|
2023-08-11 01:29:42 +00:00
|
|
|
create table sample_final (CounterID UInt32, EventDate Date, EventTime DateTime, UserID UInt64, Sign Int8) engine = CollapsingMergeTree(Sign) order by (CounterID, EventDate, intHash32(UserID), EventTime) sample by intHash32(UserID) SETTINGS index_granularity = 8192, index_granularity_bytes = '10Mi';
|
2019-11-25 13:09:44 +00:00
|
|
|
insert into sample_final select number / (8192 * 4), toDate('2019-01-01'), toDateTime('2019-01-01 00:00:01') + number, number / (8192 * 2), number % 3 = 1 ? -1 : 1 from numbers(1000000);
|
|
|
|
|
|
|
|
select 'count';
|
|
|
|
select count() from sample_final;
|
|
|
|
select 'count final';
|
|
|
|
select count() from sample_final final;
|
|
|
|
select 'count sample';
|
|
|
|
select count() from sample_final sample 1/2;
|
|
|
|
select 'count sample final';
|
|
|
|
select count() from sample_final final sample 1/2;
|
2019-11-25 15:44:15 +00:00
|
|
|
select 'count final max_parallel_replicas';
|
|
|
|
set max_parallel_replicas=2;
|
|
|
|
select count() from remote('127.0.0.{2|3}', currentDatabase(), sample_final) final;
|
2019-11-25 13:09:44 +00:00
|
|
|
|
|
|
|
drop table if exists sample_final;
|