first draft

This commit is contained in:
George 2021-02-16 00:32:39 +03:00
parent 5ac303b332
commit 6eeef74d43

View File

@ -5,7 +5,9 @@ toc_title: DETACH
# DETACH Statement {#detach} # DETACH Statement {#detach}
Deletes information about the name table from the server. The server stops knowing about the tables existence. Deletes information about the `name` table from the server. The server stops knowing about the tables existence.
Syntax:
``` sql ``` sql
DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster]
@ -13,4 +15,20 @@ DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster]
This does not delete the tables data or metadata. On the next server launch, the server will read the metadata and find out about the table again. This does not delete the tables data or metadata. On the next server launch, the server will read the metadata and find out about the table again.
Similarly, a “detached” table can be re-attached using the `ATTACH` query (with the exception of system tables, which do not have metadata stored for them). Similarly, a “detached” table can be re-attached using the [ATTACH](../../sql-reference/statements/attach) query (with the exception of system tables, which do not have metadata stored for them).
## DETACH PERMAMENTLY {#detach-permamently}
Deletes information about `name` table or view from the server. Permamently detached tables won't automatically reappear after the server restart.
Syntax:
``` sql
DETACH TABLE/VIEW [IF EXISTS] [db.]name PERMAMENTLY [ON CLUSTER cluster]
```
This statement does not delete the tables data or metadata.
Permamently detached table or view can be reattached with [ATTACH](../../sql-reference/statements/attach) query and can be shown with [SHOW CREATE TABLE](../../sql-reference/statements/show.md#show-create-table) query.
[Original article](https://clickhouse.tech/docs/en/sql-reference/statements/detach/) <!--hide-->