mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Get today datetime in UTC
This commit is contained in:
parent
9b81c075c6
commit
27cb83f5a7
@ -9,28 +9,28 @@ SET joined_subquery_requires_alias = 0;
|
||||
INSERT into test_graphite
|
||||
WITH dates AS
|
||||
(
|
||||
SELECT today() as today,
|
||||
today - 3 as older_date
|
||||
SELECT toStartOfDay(toDateTime(now('UTC'), 'UTC')) as today,
|
||||
today - INTERVAL 3 day as older_date
|
||||
)
|
||||
-- Newer than 2 days are kept in windows of 600 seconds
|
||||
select 1, 'sum_1', toDateTime(today, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 2, 'sum_1', toDateTime(today, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 1, 'sum_2', toDateTime(today, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 2, 'sum_2', toDateTime(today, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 1, 'max_1', toDateTime(today, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 2, 'max_1', toDateTime(today, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 1, 'max_2', toDateTime(today, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 2, 'max_2', toDateTime(today, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 1, 'sum_1', today - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 2, 'sum_1', today - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 1, 'sum_2', today - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 2, 'sum_2', today - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 1, 'max_1', today - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 2, 'max_1', today - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 1, 'max_2', today - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
select 2, 'max_2', today - number * 60 - 30, number, 1, number from dates, numbers(300) union all
|
||||
|
||||
-- Older than 2 days use 6000 second windows
|
||||
select 1, 'sum_1', toDateTime(older_date, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 2, 'sum_1', toDateTime(older_date, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 1, 'sum_2', toDateTime(older_date, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 2, 'sum_2', toDateTime(older_date, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 1, 'max_1', toDateTime(older_date, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 2, 'max_1', toDateTime(older_date, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 1, 'max_2', toDateTime(older_date, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 2, 'max_2', toDateTime(older_date, 'UTC') - number * 60 - 30, number, 1, number from dates, numbers(1200);
|
||||
select 1, 'sum_1', older_date - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 2, 'sum_1', older_date - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 1, 'sum_2', older_date - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 2, 'sum_2', older_date - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 1, 'max_1', older_date - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 2, 'max_1', older_date - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 1, 'max_2', older_date - number * 60 - 30, number, 1, number from dates, numbers(1200) union all
|
||||
select 2, 'max_2', older_date - number * 60 - 30, number, 1, number from dates, numbers(1200);
|
||||
|
||||
optimize table test_graphite final;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user