ClickHouse/tests/queries/0_stateless/02674_trivial_count_analyzer.reference

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-02-27 12:53:09 +00:00
-- { echoOn }
set allow_experimental_analyzer=1;
set optimize_trivial_count_query=1;
create table m3(a Int64, b UInt64) Engine=MergeTree order by tuple();
select count() from m3;
0
insert into m3 values (0,0);
insert into m3 values (-1,1);
select trimBoth(explain) from (explain select count() from m3) where explain like '%ReadFromPreparedSource (Optimized trivial count)%';
ReadFromPreparedSource (Optimized trivial count)
select count() from m3;
2
select count(*) from m3;
2
select count(a) from m3;
2
select count(b) from m3;
2
select count() + 1 from m3;
3
2023-03-01 20:19:51 +00:00
drop table m3;
2023-02-27 12:53:09 +00:00
-- checking queries with FINAL
create table replacing_m3(a Int64, b UInt64) Engine=ReplacingMergeTree() order by (a, b);
SYSTEM STOP MERGES replacing_m3;
select count() from replacing_m3;
0
insert into replacing_m3 values (0,0);
insert into replacing_m3 values (0,0);
insert into replacing_m3 values (-1,1);
insert into replacing_m3 values (-2,2);
select trimBoth(explain) from (explain select count() from replacing_m3) where explain like '%ReadFromPreparedSource (Optimized trivial count)%';
ReadFromPreparedSource (Optimized trivial count)
select count() from replacing_m3;
4
select count(*) from replacing_m3;
4
select count(a) from replacing_m3;
4
select count(b) from replacing_m3;
4
select count() from replacing_m3 FINAL;
3
select count(a) from replacing_m3 FINAL;
3
select count(b) from replacing_m3 FINAL;
3
2023-03-01 20:19:51 +00:00
drop table replacing_m3;