Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added media/sqlgram/AlterTableDropIndexSpec.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/sqlgram/AlterTableDropIndexStmt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/FlashbackTableStmt.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/FlashbackToNewName.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/IfExists.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/IgnoreOptional.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/Int64Num.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/NUM.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/PartitionNameListOpt.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/RecoverTableStmt.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/RenameTableStmt.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/RowValue.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/sqlgram/ShowTableRegionStmt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/SplitOption.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/SplitRegionStmt.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/SplitSyntaxOption.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/sqlgram/TableName.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/TableToTable.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/WhereClause.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/sqlgram/WhereClauseOptional.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 14 additions & 6 deletions sql-statements/sql-statement-drop-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,29 @@ aliases: ['/docs-cn/dev/reference/sql/statements/drop-index/']

## 语法图

**AlterTableStmt:**
**AlterTableDropIndexStmt:**

![AlterTableStmt](/media/sqlgram/AlterTableStmt.png)
![AlterTableDropIndexStmt](/media/sqlgram/AlterTableDropIndexStmt.png)

**AlterTableSpec:**
**IgnoreOptional:**

![AlterTableSpec](/media/sqlgram/AlterTableSpec.png)
![IgnoreOptional](/media/sqlgram/IgnoreOptional.png)

**TableName:**

![TableName](/media/sqlgram/TableName.png)

**AlterTableDropIndexSpec:**

![AlterTableDropIndexSpec](/media/sqlgram/AlterTableDropIndexSpec.png)

**KeyOrIndex:**

![KeyOrIndex](/media/sqlgram/KeyOrIndex.png)

**Identifier:**
**IfExists:**

![Identifier](/media/sqlgram/Identifier.png)
![IfExists](/media/sqlgram/IfExists.png)

## 示例

Expand Down
14 changes: 14 additions & 0 deletions sql-statements/sql-statement-flashback-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ aliases: ['/docs-cn/dev/reference/sql/statements/flashback-table/']
FLASHBACK TABLE table_name [TO other_table_name]
```

### 语法图

**FlashbackTableStmt:**

![FlashbackTableStmt](/media/sqlgram/FlashbackTableStmt.png)

**TableName:**

![TableName](/media/sqlgram/TableName.png)

**FlashbackToNewName:**

![FlashbackToNewName](/media/sqlgram/FlashbackToNewName.png)

## 注意事项

如果删除了一张表并过了 GC lifetime,就不能再用 `FLASHBACK TABLE` 语句来恢复被删除的数据了,否则会返回错误,错误类似于 `Can't find dropped/truncated table 't' in GC safe point 2020-03-16 16:34:52 +0800 CST`。
Expand Down
18 changes: 18 additions & 0 deletions sql-statements/sql-statement-recover-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ RECOVER TABLE table_name
RECOVER TABLE BY JOB ddl_job_id
```

### 语法图

**RecoverTableStmt:**

![RecoverTableStmt](/media/sqlgram/RecoverTableStmt.png)

**TableName:**

![TableName](/media/sqlgram/TableName.png)

**Int64Num:**

![Int64Num](/media/sqlgram/Int64Num.png)

**NUM:**

![NUM](/media/sqlgram/NUM.png)

## 注意事项

如果删除表后并过了 GC lifetime,就不能再用 `RECOVER TABLE` 来恢复被删除的表了,执行 `RECOVER TABLE` 语句会返回类似错误:`snapshot is older than GC safe point 2019-07-10 13:45:57 +0800 CST`。
Expand Down
24 changes: 23 additions & 1 deletion sql-statements/sql-statement-show-table-regions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,36 @@ aliases: ['/docs-cn/dev/reference/sql/statements/show-table-regions/']

`SHOW TABLE REGIONS` 语句用于显示 TiDB 中某个表的 Region 信息。

## 语法图
## 语法

```sql
SHOW TABLE [table_name] REGIONS [WhereClauseOptional];

SHOW TABLE [table_name] INDEX [index_name] REGIONS [WhereClauseOptional];
```

### 语法图

**ShowTableRegionStmt:**

![ShowTableRegionStmt](/media/sqlgram/ShowTableRegionStmt.png)

**TableName:**

![TableName](/media/sqlgram/TableName.png)

**PartitionNameListOpt:**

![PartitionNameListOpt](/media/sqlgram/PartitionNameListOpt.png)

**WhereClauseOptional:**

![WhereClauseOptional](/media/sqlgram/WhereClauseOptional.png)

**WhereClause:**

![WhereClause](/media/sqlgram/WhereClause.png)

`SHOW TABLE REGIONS` 会返回如下列:

* `REGION_ID`:Region 的 ID。
Expand Down
30 changes: 30 additions & 0 deletions sql-statements/sql-statement-split-region.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@ aliases: ['/docs-cn/dev/reference/sql/statements/split-region/']

为解决上述场景中的热点问题,TiDB 引入了预切分 Region 的功能,即可以根据指定的参数,预先为某个表切分出多个 Region,并打散到各个 TiKV 上去。

## 语法图

**SplitRegionStmt:**

![SplitRegionStmt](/media/sqlgram/SplitRegionStmt.png)

**SplitSyntaxOption:**

![SplitSyntaxOption](/media/sqlgram/SplitSyntaxOption.png)

**TableName:**

![TableName](/media/sqlgram/TableName.png)

**PartitionNameListOpt:**

![PartitionNameListOpt](/media/sqlgram/PartitionNameListOpt.png)

**SplitOption:**

![SplitOption](/media/sqlgram/SplitOption.png)

**RowValue:**

![RowValue](/media/sqlgram/RowValue.png)

**Int64Num:**

![Int64Num](/media/sqlgram/Int64Num.png)

## Split Region 的使用

Split Region 有 2 种不同的语法,具体如下:
Expand Down