2021-05-31 02:31:45 +00:00
|
|
|
drop table if exists tp;
|
|
|
|
|
|
|
|
create table tp (d1 Int32, d2 Int32, eventcnt Int64, projection p (select sum(eventcnt) group by d1)) engine = MergeTree order by (d1, d2);
|
|
|
|
|
2023-05-10 01:35:13 +00:00
|
|
|
set optimize_use_projections = 1, force_optimize_projection = 1;
|
2021-05-31 02:31:45 +00:00
|
|
|
|
|
|
|
select sum(eventcnt) eventcnt, d1 from tp group by d1;
|
|
|
|
|
|
|
|
select avg(eventcnt) eventcnt, d1 from tp group by d1;
|
|
|
|
|
|
|
|
insert into tp values (1, 2, 3);
|
|
|
|
|
|
|
|
select sum(eventcnt) eventcnt, d1 from tp group by d1;
|
|
|
|
|
|
|
|
select avg(eventcnt) eventcnt, d1 from tp group by d1; -- { serverError 584 }
|
|
|
|
|
|
|
|
drop table tp;
|