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

sql-plan-replayer: add description for PLAN REPLAYER CAPTURE REMOVE (#17417) #17425

Merged
Merged
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
25 changes: 24 additions & 1 deletion sql-plan-replayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ mysql> SELECT * FROM mysql.plan_replayer_task;

### 查看 `PLAN REPLAYER CAPTURE` 抓取结果

当 `PLAN REPLAYER CAPTURE` 成功抓取到结果后,可以通过以下 SQL 语句查看用于下载的文件标识:
当 `PLAN REPLAYER CAPTURE` 成功抓取到结果后,可以通过以下 SQL 语句查看用于下载的文件标识

```sql
mysql> SELECT * FROM mysql.plan_replayer_status;
Expand All @@ -260,6 +260,29 @@ mysql> SELECT * FROM mysql.plan_replayer_status;
>
> `PLAN REPLAYER CAPTURE` 的结果文件最多会在 TiDB 集群中保存一周,超时后 TiDB 会将其删除。

### 移除 `PLAN REPLAYER CAPTURE` 抓取任务

不再需要某个 `PLAN REPLAYER CAPTURE` 抓取任务后,你可以通过 `PLAN REPLAYER CAPTURE REMOVE` 语句将其移除。示例如下:

```sql
mysql> PLAN REPLAYER CAPTURE '077a87a576e42360c95530ccdac7a1771c4efba17619e26be50a4cfd967204a0' '4838af52c1e07fc8694761ad193d16a689b2128bc5ced9d13beb31ae27b370ce';
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT * FROM mysql.plan_replayer_task;
+------------------------------------------------------------------+------------------------------------------------------------------+---------------------+
| sql_digest | plan_digest | update_time |
+------------------------------------------------------------------+------------------------------------------------------------------+---------------------+
| 077a87a576e42360c95530ccdac7a1771c4efba17619e26be50a4cfd967204a0 | 4838af52c1e07fc8694761ad193d16a689b2128bc5ced9d13beb31ae27b370ce | 2024-05-21 11:26:10 |
+------------------------------------------------------------------+------------------------------------------------------------------+---------------------+
1 row in set (0.01 sec)

mysql> PLAN REPLAYER CAPTURE REMOVE '077a87a576e42360c95530ccdac7a1771c4efba17619e26be50a4cfd967204a0' '4838af52c1e07fc8694761ad193d16a689b2128bc5ced9d13beb31ae27b370ce';
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT * FROM mysql.plan_replayer_task;
Empty set (0.01 sec)
```

## 使用 `PLAN REPLAYER CONTINUOUS CAPTURE`

开启 `PLAN REPLAYER CONTINUOUS CAPTURE` 功能后,TiDB 将以 SQL DIGEST 和 PLAN DIGEST 为维度异步地将业务 SQL 语句以 `PLAN REPLAYER` 的方式进行记录,对于相同 DIGEST 的 SQL 语句与执行计划,`PLAN REPLAYER CONTINUOUS CAPTURE` 不会重复记录。
Expand Down
Loading