mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
1.1 KiB
1.1 KiB
slug | sidebar_position | sidebar_label | title |
---|---|---|---|
/en/sql-reference/statements/alter/sample-by | 41 | SAMPLE BY | Manipulating Sampling-Key Expressions |
Manipulating SAMPLE BY expression
The following operations are available:
MODIFY
ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY SAMPLE BY new_expression
The command changes the sampling key of the table to new_expression
(an expression or a tuple of expressions). The primary key must contain the new sample key.
REMOVE
ALTER TABLE [db].name [ON CLUSTER cluster] REMOVE SAMPLE BY
The command removes the sampling key of the table.
The commands MODIFY
and REMOVE
are lightweight in the sense that they only change metadata or remove files.
:::note
It only works for tables in the MergeTree family (including replicated tables).
:::