Skip to content

Commit

Permalink
update some syntax diagram (#2830)
Browse files Browse the repository at this point in the history
Signed-off-by: crazycs520 <[email protected]>
  • Loading branch information
crazycs520 authored Jun 15, 2020
1 parent e58f5fe commit 18bc266
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 7 deletions.
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 @@ This statement removes an index from a specified table, marking space as free in

## Synopsis

**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)

## Examples

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 @@ -25,6 +25,20 @@ select * from mysql.tidb where variable_name in ('tikv_gc_safe_point','tikv_gc_l
FLASHBACK TABLE table_name [TO other_table_name]
```

## Synopsis

**FlashbackTableStmt:**

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

**TableName:**

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

**FlashbackToNewName:**

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

## Notes

If a table is dropped and the GC lifetime has passed, you can no longer use the `FLASHBACK TABLE` statement to recover the dropped data. Otherwise, an error like `Can't find dropped / truncated table 't' in GC safe point 2020-03-16 16:34:52 +0800 CST` will be returned.
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 @@ -23,6 +23,24 @@ RECOVER TABLE table_name
RECOVER TABLE BY JOB ddl_job_id
```

## Synopsis

**RecoverTableStmt:**

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

**TableName:**

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

**Int64Num:**

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

**NUM:**

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

> **Note:**
>
> + If a table is deleted and the GC lifetime is out, the table cannot be recovered with `RECOVER TABLE`. Execution of `RECOVER TABLE` in this scenario returns an error like: `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,13 +9,35 @@ aliases: ['/docs/dev/reference/sql/statements/show-table-regions/']

The `SHOW TABLE REGIONS` statement is used to show the Region information of a table in TiDB.

## Synopsis
## Syntax

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

## Synopsis

**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)

Executing `SHOW TABLE REGIONS` returns the following columns:

* `REGION_ID`: The 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 @@ -13,6 +13,36 @@ In the above case, because there is only one Region at the beginning, all write

To solve the hotspot problem in the above scenario, TiDB introduces the pre-split function, which can pre-split multiple Regions for a certain table according to the specified parameters and scatter them to each TiKV node.

## Synopsis

**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)

## Usage of Split Region

There are two types of Split Region syntax:
Expand Down

0 comments on commit 18bc266

Please sign in to comment.