2023-02-02 13:37:08 +00:00
|
|
|
-- Tags: no-s3-storage
|
|
|
|
|
2022-09-26 22:01:00 +00:00
|
|
|
DROP TABLE IF EXISTS table_in_memory;
|
2022-09-22 22:51:13 +00:00
|
|
|
|
2022-09-26 22:01:00 +00:00
|
|
|
CREATE TABLE table_in_memory
|
2022-09-22 22:51:13 +00:00
|
|
|
(
|
|
|
|
`id` UInt64,
|
|
|
|
`value` UInt64
|
|
|
|
)
|
|
|
|
ENGINE = MergeTree
|
|
|
|
PARTITION BY id
|
|
|
|
ORDER BY value
|
|
|
|
SETTINGS min_bytes_for_wide_part=1000, min_bytes_for_compact_part=900;
|
|
|
|
|
|
|
|
SELECT 'init state';
|
2022-09-26 22:01:00 +00:00
|
|
|
INSERT INTO table_in_memory SELECT intDiv(number, 10), number FROM numbers(30);
|
2022-09-22 22:51:13 +00:00
|
|
|
|
2022-09-26 22:01:00 +00:00
|
|
|
SELECT count() FROM table_in_memory;
|
|
|
|
SELECT name, part_type, rows, active from system.parts
|
|
|
|
WHERE table='table_in_memory' AND database=currentDatabase();
|
2022-09-22 22:51:13 +00:00
|
|
|
|
|
|
|
SELECT 'drop part 0';
|
2022-09-26 22:01:00 +00:00
|
|
|
ALTER TABLE table_in_memory DROP PARTITION 0;
|
2022-09-22 22:51:13 +00:00
|
|
|
|
2022-09-26 22:01:00 +00:00
|
|
|
SELECT count() FROM table_in_memory;
|
|
|
|
SELECT name, part_type, rows, active from system.parts
|
2022-09-28 23:46:21 +00:00
|
|
|
WHERE table='table_in_memory' AND database=currentDatabase() AND active;
|
2022-09-22 22:51:13 +00:00
|
|
|
|
|
|
|
SELECT 'detach table';
|
2022-09-26 22:01:00 +00:00
|
|
|
DETACH TABLE table_in_memory;
|
2022-09-22 22:51:13 +00:00
|
|
|
|
2022-09-26 22:01:00 +00:00
|
|
|
SELECT name, part_type, rows, active from system.parts
|
|
|
|
WHERE table='table_in_memory' AND database=currentDatabase();
|
2022-09-22 22:51:13 +00:00
|
|
|
|
|
|
|
SELECT 'attach table';
|
2022-09-26 22:01:00 +00:00
|
|
|
ATTACH TABLE table_in_memory;
|
2022-09-22 22:51:13 +00:00
|
|
|
|
2022-09-26 22:01:00 +00:00
|
|
|
SELECT count() FROM table_in_memory;
|
|
|
|
SELECT name, part_type, rows, active from system.parts
|
2022-12-02 13:09:04 +00:00
|
|
|
WHERE table='table_in_memory' AND database=currentDatabase() and active;
|