ClickHouse/docs/en/sql-reference/statements/alter/sample-by.md
2022-08-29 12:19:50 -04:00

775 B

slug sidebar_position sidebar_label title
/en/sql-reference/statements/alter/sample-by 41 SAMPLE BY Manipulating Sampling-Key Expressions

Syntax:

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 command is lightweight in the sense that it only changes metadata. The primary key must contain the new sample key.

:::note
It only works for tables in the MergeTree family (including replicated tables). :::