dbms: Server: feature development. [#METR-15090]

This commit is contained in:
Alexey Arno 2015-04-09 16:53:29 +03:00
parent 1ef3ae9dc4
commit dd5584ea9a
4 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,43 @@
100
2014-06-01 10
2014-06-02 10
2014-06-03 10
2014-06-04 10
2014-06-05 10
2014-06-06 10
2014-06-07 10
2014-06-08 10
2014-06-09 10
2014-06-10 10
155
2014-06-01 10
2014-06-02 10
2014-06-03 10
2014-06-04 10
2014-06-05 10
2014-06-06 15
2014-06-07 15
2014-06-08 15
2014-06-09 15
2014-06-10 15
2014-06-11 10
2014-06-12 10
2014-06-13 10
2014-06-14 10
2014-06-15 10
155
2014-06-01 10
2014-06-02 10
2014-06-03 10
2014-06-04 10
2014-06-05 10
2014-06-06 15
2014-06-07 15
2014-06-08 15
2014-06-09 15
2014-06-10 15
2014-06-11 10
2014-06-12 10
2014-06-13 10
2014-06-14 10
2014-06-15 10

View File

@ -0,0 +1,47 @@
SET min_bytes_to_use_direct_io = 128;
DROP TABLE IF EXISTS test.stored_aggregates;
CREATE TABLE test.stored_aggregates
(
d Date,
Uniq AggregateFunction(uniq, UInt64)
)
ENGINE = AggregatingMergeTree(d, d, 8192);
INSERT INTO test.stored_aggregates
SELECT
toDate(toUInt16(toDate('2014-06-01')) + intDiv(number, 100)) AS d,
uniqState(intDiv(number, 10)) AS Uniq
FROM
(
SELECT * FROM system.numbers LIMIT 1000
)
GROUP BY d;
SELECT uniqMerge(Uniq) FROM test.stored_aggregates;
SELECT d, uniqMerge(Uniq) FROM test.stored_aggregates GROUP BY d ORDER BY d;
INSERT INTO test.stored_aggregates
SELECT
toDate(toUInt16(toDate('2014-06-01')) + intDiv(number, 100)) AS d,
uniqState(intDiv(number + 50, 10)) AS Uniq
FROM
(
SELECT * FROM system.numbers LIMIT 500, 1000
)
GROUP BY d;
SELECT uniqMerge(Uniq) FROM test.stored_aggregates;
SELECT d, uniqMerge(Uniq) FROM test.stored_aggregates GROUP BY d ORDER BY d;
OPTIMIZE TABLE test.stored_aggregates;
SELECT uniqMerge(Uniq) FROM test.stored_aggregates;
SELECT d, uniqMerge(Uniq) FROM test.stored_aggregates GROUP BY d ORDER BY d;
DROP TABLE test.stored_aggregates;