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

add sql statement for show analyze status #3329

Merged
merged 11 commits into from
May 26, 2020
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@
- [`SET PASSWORD`](/sql-statements/sql-statement-set-password.md)
- [`SET TRANSACTION`](/sql-statements/sql-statement-set-transaction.md)
- [`SET [GLOBAL|SESSION] <variable>`](/sql-statements/sql-statement-set-variable.md)
- [`SHOW ANALYZE STATUS`](/sql-statements/sql-statement-show-analyze-status.md)
- [`SHOW BINDINGS`](/sql-statements/sql-statement-show-bindings.md)
- [`SHOW BUILTINS`](/sql-statements/sql-statement-show-builtins.md)
- [`SHOW CHARACTER SET`](/sql-statements/sql-statement-show-character-set.md)
Expand Down
49 changes: 49 additions & 0 deletions sql-statements/sql-statement-show-analyze-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: SHOW ANALYZE STATUS
TomShawn marked this conversation as resolved.
Show resolved Hide resolved
summary: TiDB 数据库中 SHOW ANALYZE STATUS 的使用概况。
category: reference
---

# SHOW ANALYZE STATUS

`SHOW ANALYZE STATUS` 语句提供 TiDB 正在执行的统计信息收集任务以及有限条历史任务记录。

## 语法图

**ShowStmt:**

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

**ShowTargetFilterable:**

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

## 示例

{{< copyable "sql" >}}

```sql
create table t(x int, index idx(x)) partition by hash(x) partition 4;
analyze table t;
show analyze status;
TomShawn marked this conversation as resolved.
Show resolved Hide resolved
```

```sql
+--------------+------------+----------------+-------------------+----------------+---------------------+----------+
| Table_schema | Table_name | Partition_name | Job_info | Processed_rows | Start_time | State |
+--------------+------------+----------------+-------------------+----------------+---------------------+----------+
| test | t | p1 | analyze columns | 0 | 2020-05-25 17:23:55 | finished |
| test | t | p0 | analyze columns | 0 | 2020-05-25 17:23:55 | finished |
| test | t | p0 | analyze index idx | 0 | 2020-05-25 17:23:55 | finished |
| test | t | p1 | analyze index idx | 0 | 2020-05-25 17:23:55 | finished |
| test | t | p2 | analyze index idx | 0 | 2020-05-25 17:23:55 | finished |
| test | t | p3 | analyze index idx | 0 | 2020-05-25 17:23:55 | finished |
| test | t | p3 | analyze columns | 0 | 2020-05-25 17:23:55 | finished |
| test | t | p2 | analyze columns | 0 | 2020-05-25 17:23:55 | finished |
+--------------+------------+----------------+-------------------+----------------+---------------------+----------+
8 rows in set (0.00 sec)
```

## 另请参阅

* [ANALYZE_STATUS 表](/system-tables/system-table-information-schema.md#analyze_status-表)