mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 21:24:28 +00:00
8f03e526a4
* Edit and translate Отредактировал английскую версию текстов документов и перевел изменения на русский язык. * Update trace_log.md Исправляю битые ссылки. * Fixing broken links Исправил битые ссылки. * Fixing broken links Поправил битую ссылку, добавив раздел в русскую версию. Co-authored-by: Dmitriy <sevirov@yandex-team.ru>
20 lines
760 B
Markdown
20 lines
760 B
Markdown
---
|
|
toc_priority: 41
|
|
toc_title: SAMPLE BY
|
|
---
|
|
|
|
# Manipulating Sampling-Key Expressions {#manipulations-with-sampling-key-expressions}
|
|
|
|
Syntax:
|
|
|
|
``` sql
|
|
ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY SAMPLE BY new_expression
|
|
```
|
|
|
|
The command changes the [sampling key](../../../engines/table-engines/mergetree-family/mergetree.md) 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 "Note"
|
|
It only works for tables in the [MergeTree](../../../engines/table-engines/mergetree-family/mergetree.md) family (including
|
|
[replicated](../../../engines/table-engines/mergetree-family/replication.md) tables). |