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 syntax gram of load stats #3362

Merged
merged 9 commits into from
May 27, 2020
37 changes: 37 additions & 0 deletions sql-statements/sql-statement-load-stats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: LOAD STATS
summary: TiDB 数据库中 LOAD STATS 的使用概况。
category: reference
---

# LOAD STATS

`LOAD STATS` 语句用于将统计信息加载到 TiDB 中。

## 语法图

**LoadStatsStmt:**

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

## 参数说明

用户直接指定统计信息文件路径,统计信息文件可通过访问 API `http://${tidb-server-ip}:${tidb-server-status-port}/stats/dump/${db_name}/${table_name}` 进行下载。

路径可以是相对路径,也可以是绝对路径,如果是相对路径,会从启动 `tidb-server` 的路径为起点寻找对应文件。

下面是一个绝对路径的例子:

{{< copyable "sql" >}}

```sql
LOAD STATS '/tmp/stats.json';
```

```
Query OK, 0 rows affected (0.00 sec)
```

## 另请参阅

* [统计信息](/statistics.md)