2018-08-07 17:08:51 +00:00
|
|
|
DROP TABLE IF EXISTS test.hits_dst;
|
|
|
|
DROP TABLE IF EXISTS test.hits_buffer;
|
|
|
|
|
2024-01-14 06:50:35 +00:00
|
|
|
CREATE TABLE test.hits_dst AS test.hits
|
|
|
|
ENGINE = MergeTree
|
|
|
|
PARTITION BY toYYYYMM(EventDate)
|
|
|
|
ORDER BY (CounterID, EventDate, intHash32(UserID))
|
|
|
|
SAMPLE BY intHash32(UserID)
|
|
|
|
SETTINGS storage_policy = 'default';
|
|
|
|
|
2023-08-03 11:46:57 +00:00
|
|
|
CREATE TABLE test.hits_buffer AS test.hits_dst ENGINE = Buffer(test, hits_dst, 8, 600, 600, 1000000, 1000000, 100000000, 1000000000);
|
2018-08-07 17:08:51 +00:00
|
|
|
|
2018-12-29 22:11:00 +00:00
|
|
|
INSERT INTO test.hits_buffer SELECT * FROM test.hits WHERE CounterID = 800784;
|
2018-08-07 17:08:51 +00:00
|
|
|
SELECT count() FROM test.hits_buffer;
|
|
|
|
SELECT count() FROM test.hits_dst;
|
|
|
|
|
|
|
|
OPTIMIZE TABLE test.hits_buffer;
|
|
|
|
SELECT count() FROM test.hits_buffer;
|
|
|
|
SELECT count() FROM test.hits_dst;
|
|
|
|
|
|
|
|
DROP TABLE test.hits_dst;
|
|
|
|
DROP TABLE test.hits_buffer;
|