Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] add validity period during which users can restore a deleted table #8788

Merged
merged 5 commits into from
Jul 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 5 additions & 9 deletions docs/sql-reference/sql-statements/data-definition/DROP TABLE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# DROP TABLE

## description
## Description
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shell we modify those format things in such unfied ways?
I see that a lot of other pages haven't been modified yet.

And, will we remove the "Keyword" section? (I think it's good to keep it)

Copy link
Contributor Author

@femiiii femiiii Jul 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaogoy
We will gradually modify the format of titles. "The Keyword section(in SQL and function) needed to be deleted. " This has been confirmed with simo.


This statement is used to delete a table.

Syntax:
## Syntax

```sql
DROP TABLE [IF EXISTS] [db_name.]table_name [FORCE];
```

Note:

1. After executing DROP TABLE for a while, you can use RECOVER statement to restore the dropped table. See RECOVER statement for more detail.
2. If DROP Table FORCE is executed, the table will be deleted directly and cannot be recovered without checking whether there are unfinished activities in the database. Generally this operation is not recommended.
- If it has not been more than a day since a table was deleted by using the DROP TABLE statement, you can use the [RECOVER](../data-definition/RECOVER.md) statement to restore the table.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should pay attention on this RECOVER page:
"It can only recover meta-information deleted some time ago", can it only recover meta-information? can't it recover the data? you can check it from RDs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaogoy
Confirmed the following info with simo:
For example, after executing the DROP TABLE statement to delete a table, SR first deletes the metadata of this table. Then if it has been more than a day since a table was deleted, SR will delete the data in this table.

That's why "If it has not been more than a day since a table was deleted by using the DROP TABLE statement, you can use the RECOVER statement to restore the table."

The description in the RECOVER statement is incorrect and need to be revised.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.
we should say something in the user's shoes: DROP will not just delete the metadata, it will delete the data too, all of them are moved to trash bin.

- If DROP Table FORCE is executed, the table will be deleted directly and cannot be recovered without checking whether there are unfinished activities in the database. Generally this operation is not recommended.

## example
## Examples

1. Drop a table.

Expand All @@ -34,7 +34,3 @@ Note:
```sql
DROP TABLE my_table FORCE;
```

## keyword

DROP,TABLE