Skip to content

Commit

Permalink
reference/performance: add description for stats healthy (#1888) (#1902)
Browse files Browse the repository at this point in the history
Co-authored-by: Junlan Zhang <zhangjunlan@pingcap.com>
  • Loading branch information
sre-bot and junlan-zhang authored Feb 28, 2020
1 parent 6d022a0 commit fdb6a01
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions reference/performance/statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,27 @@ Currently, the `SHOW STATS_META` statement returns the following 6 columns:
>
> When TiDB automatically updates the total number of rows and the number of modified rows according to DML statements, `update_time` is also updated. Therefore, `update_time` does not necessarily indicate the last time when the `ANALYZE` statement is executed.

### Health state of tables

You can use the `SHOW STATS_HEALTHY` statement to check the health state of tables and roughly estimate the accuracy of the statistics. When `modify_count` >= `row_count`, the health state is 0; when `modify_count` < `row_count`, the health state is (1 - `modify_count`/`row_count`) * 100.

The syntax is as follows. You can use `ShowLikeOrWhere` to filter the information you need:

{{< copyable "sql" >}}

```sql
SHOW STATS_HEALTHY [ShowLikeOrWhere];
```

Currently, the `SHOW STATS_HEALTHY` statement returns the following 4 columns:

| Syntax Element | Description |
| :-------- | :------------- |
| `db_name` | The database name |
| `table_name` | The table name |
| `partition_name` | The partition name |
| `healthy` | The health state of tables |

### Metadata of columns

You can use the `SHOW STATS_HISTOGRAMS` statement to view the number of different values and the number of `NULL` in all the columns.
Expand Down

0 comments on commit fdb6a01

Please sign in to comment.