ClickHouse/tests/queries/0_stateless/01236_graphite_mt.sql

30 lines
2.1 KiB
MySQL
Raw Normal View History

2020-04-14 17:09:11 +00:00
drop table if exists test_graphite;
2021-07-26 04:03:38 +00:00
create table test_graphite (key UInt32, Path String, Time DateTime, Value Float64, Version UInt32, col UInt64)
engine = GraphiteMergeTree('graphite_rollup') order by key settings index_granularity=10;
2020-04-14 17:09:11 +00:00
2020-11-11 15:29:36 +00:00
insert into test_graphite
2021-07-26 04:03:38 +00:00
select 1, 'sum_1', toDateTime(today()) - number * 60 - 30, number, 1, number from numbers(300) union all
select 2, 'sum_1', toDateTime(today()) - number * 60 - 30, number, 1, number from numbers(300) union all
select 1, 'sum_2', toDateTime(today()) - number * 60 - 30, number, 1, number from numbers(300) union all
select 2, 'sum_2', toDateTime(today()) - number * 60 - 30, number, 1, number from numbers(300) union all
select 1, 'max_1', toDateTime(today()) - number * 60 - 30, number, 1, number from numbers(300) union all
select 2, 'max_1', toDateTime(today()) - number * 60 - 30, number, 1, number from numbers(300) union all
select 1, 'max_2', toDateTime(today()) - number * 60 - 30, number, 1, number from numbers(300) union all
select 2, 'max_2', toDateTime(today()) - number * 60 - 30, number, 1, number from numbers(300);
2020-04-14 17:09:11 +00:00
2020-11-11 15:29:36 +00:00
insert into test_graphite
2021-07-26 04:03:38 +00:00
select 1, 'sum_1', toDateTime(today() - 3) - number * 60 - 30, number, 1, number from numbers(1200) union all
select 2, 'sum_1', toDateTime(today() - 3) - number * 60 - 30, number, 1, number from numbers(1200) union all
select 1, 'sum_2', toDateTime(today() - 3) - number * 60 - 30, number, 1, number from numbers(1200) union all
select 2, 'sum_2', toDateTime(today() - 3) - number * 60 - 30, number, 1, number from numbers(1200) union all
select 1, 'max_1', toDateTime(today() - 3) - number * 60 - 30, number, 1, number from numbers(1200) union all
select 2, 'max_1', toDateTime(today() - 3) - number * 60 - 30, number, 1, number from numbers(1200) union all
select 1, 'max_2', toDateTime(today() - 3) - number * 60 - 30, number, 1, number from numbers(1200) union all
select 2, 'max_2', toDateTime(today() - 3) - number * 60 - 30, number, 1, number from numbers(1200);
2020-04-14 17:09:11 +00:00
2021-07-26 04:03:38 +00:00
optimize table test_graphite final;
2020-04-14 17:09:11 +00:00
select key, Path, Value, Version, col from test_graphite order by key, Path, Time desc;
2020-11-11 15:29:36 +00:00
drop table test_graphite;