mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
28 lines
536 B
SQL
28 lines
536 B
SQL
|
|
DROP TABLE IF EXISTS table_01;
|
|
|
|
CREATE TABLE table_01 (
|
|
date Date,
|
|
n Int32
|
|
) ENGINE = MergeTree()
|
|
PARTITION BY date
|
|
ORDER BY date;
|
|
|
|
INSERT INTO table_01 SELECT toDate('2019-10-01'), number FROM system.numbers LIMIT 1000;
|
|
|
|
SELECT COUNT() FROM table_01;
|
|
|
|
ALTER TABLE table_01 DETACH PARTITION ID '20191001';
|
|
|
|
SELECT COUNT() FROM table_01;
|
|
|
|
ALTER TABLE table_01 ATTACH PART '20191001_1_1_0';
|
|
|
|
SELECT COUNT() FROM table_01;
|
|
|
|
ALTER TABLE table_01 DETACH PARTITION ALL;
|
|
|
|
SELECT COUNT() FROM table_01;
|
|
|
|
DROP TABLE IF EXISTS table_01;
|