Created
May 23, 2025 21:47
-
-
Save den-crane/10993438d05bfda47d5a62824e7d32c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE test(A Int64, X String) | |
ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/test', 'R1') | |
ORDER BY A; | |
system stop merges test; | |
insert into test values(1, 0); | |
insert into test values(1, 1); | |
insert into test values(1, 2); | |
insert into test values(1, 4); | |
insert into test values(1, 5); | |
insert into test values(1, 6); | |
insert into test values(1, 7); | |
insert into test values(1, 8); | |
insert into test values(1, 9); | |
insert into test values(1, 10); | |
insert into test values(1, 11); | |
insert into test values(1, 12); | |
insert into test values(1, 13); | |
select * from test final; | |
┌─A─┬─X──┐ | |
│ 1 │ 13 │ | |
└───┴────┘ | |
alter table test detach partition tuple(); alter table test attach partition tuple(); | |
select * from test final; | |
┌─A─┬─X─┐ | |
│ 1 │ 1 │ | |
└───┴───┘ | |
drop table test; | |
CREATE TABLE test(A Int64, X String) | |
ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/test', 'R1') | |
ORDER BY A; | |
system stop merges test; | |
insert into test values(1, 0); | |
insert into test values(1, 1); | |
insert into test values(1, 2); | |
insert into test values(1, 4); | |
insert into test values(1, 5); | |
insert into test values(1, 6); | |
insert into test values(1, 7); | |
insert into test values(1, 8); | |
insert into test values(1, 9); | |
insert into test values(1, 10); | |
insert into test values(1, 11); | |
insert into test values(1, 12); | |
insert into test values(1, 13); | |
select * from test final; | |
┌─A─┬─X──┐ | |
│ 1 │ 13 │ | |
└───┴────┘ | |
detach table test; SYSTEM DROP REPLICA 'R1' FROM ZKPATH '/clickhouse/tables/test'; | |
attach table test; | |
select * from test final; | |
┌─A─┬─X──┐ | |
│ 1 │ 13 │ | |
└───┴────┘ | |
system restore replica test; | |
select * from test final; | |
┌─A─┬─X──┐ | |
│ 1 │ 13 │ | |
└───┴────┘ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment