Skip to content

Commit

Permalink
sql-plan-replayer: add description for PLAN REPLAYER CAPTURE REMOVE (
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored May 21, 2024
1 parent 1628d4e commit a2e46a3
Showing 1 changed file with 24 additions and 1 deletion.
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

0 comments on commit a2e46a3

Please sign in to comment.