ClickHouse/docs/en/sql-reference/statements/truncate.md

22 lines
1.3 KiB
Markdown
Raw Normal View History

2020-07-11 11:05:49 +00:00
---
toc_priority: 52
2020-07-23 13:04:13 +00:00
toc_title: TRUNCATE
2020-07-11 11:05:49 +00:00
---
# TRUNCATE Statement {#truncate-statement}
``` sql
TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster]
```
Removes all data from a table. When the clause `IF EXISTS` is omitted, the query returns an error if the table does not exist.
The `TRUNCATE` query is not supported for [View](../../engines/table-engines/special/view.md), [File](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md), [Buffer](../../engines/table-engines/special/buffer.md) and [Null](../../engines/table-engines/special/null.md) table engines.
DOCSUP-13875: Document the replication_wait_for_inactive_replica_timeout setting (#28464) * Add documentation of settings Задокументировал две настройки. * Fix links Поправил ссылки. * Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/sql-reference/statements/alter/index.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/sql-reference/statements/alter/index.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/sql-reference/statements/optimize.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/sql-reference/statements/truncate.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/sql-reference/statements/truncate.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Translate to Russian Выполнил перевод на русский язык. * Fix links Поправил ссылки. * Update settings.md Поправил перевод. * Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/sql-reference/statements/alter/index.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/sql-reference/statements/optimize.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/sql-reference/statements/truncate.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/ru/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/ru/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> * Fix errors Исправил неточности в описании. * Update optimize.md Поправил описание запроса OPTIMIZE. Co-authored-by: Dmitriy <sevirov@yandex-team.ru> Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com>
2021-09-09 20:33:08 +00:00
You can use the [replication_alter_partitions_sync](../../operations/settings/settings.md#replication-alter-partitions-sync) setting to set up waiting for actions to be executed on replicas.
You can specify how long (in seconds) to wait for inactive replicas to execute `TRUNCATE` queries with the [replication_wait_for_inactive_replica_timeout](../../operations/settings/settings.md#replication-wait-for-inactive-replica-timeout) setting.
!!! info "Note"
If the `replication_alter_partitions_sync` is set to `2` and some replicas are not active for more than the time, specified by the `replication_wait_for_inactive_replica_timeout` setting, then an exception `UNFINISHED` is thrown.