diff --git a/sql-plan-replayer.md b/sql-plan-replayer.md index fb13de07136f..aea3e6d7fc83 100644 --- a/sql-plan-replayer.md +++ b/sql-plan-replayer.md @@ -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; @@ -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` 不会重复记录。