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
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
- [`INSERT`](/sql-statements/sql-statement-insert.md)
- [`KILL [TIDB]`](/sql-statements/sql-statement-kill.md)
- [`LOAD DATA`](/sql-statements/sql-statement-load-data.md)
- [`LOAD STATS`](/sql-statements/sql-statement-load-stats.md)
- [`MODIFY COLUMN`](/sql-statements/sql-statement-modify-column.md)
- [`PREPARE`](/sql-statements/sql-statement-prepare.md)
- [`RENAME INDEX`](/sql-statements/sql-statement-rename-index.md)
Expand Down
Binary file added media/sqlgram/LoadStatsStmt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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: An overview of the usage of LOAD STATS for the TiDB database.
category: reference
---

# LOAD STATS

The `LOAD STATS` statement is used to load the statistics into TiDB.

## Synopsis

**LoadStatsStmt:**

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

## Examples

You can access the address `http://${tidb-server-ip}:${tidb-server-status-port}/stats/dump/${db_name}/${table_name}` to download the TiDB instance's statistics.

You can also use `LOAD STATS ${stats_path}` to load the specific statistics file.

The `${stats_path}` can be an absolute path or a relative path. If you use a relative path, the corresponding file is found starting from the path where `tidb-server` is started. Here is an example:

{{< copyable "sql" >}}

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

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

## See also

* [Statistics](/statistics.md)