From f70d793ca84a9c724493902293d026a6e5663678 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Mon, 25 Mar 2024 18:02:17 +0800 Subject: [PATCH] docs: Disable auto_analyze for plan_replayer (#16805) (#16834) --- sql-plan-replayer.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sql-plan-replayer.md b/sql-plan-replayer.md index d849aafc9e3e3..c5a3bc5801b4f 100644 --- a/sql-plan-replayer.md +++ b/sql-plan-replayer.md @@ -143,7 +143,7 @@ With an existing `ZIP` file exported using `PLAN REPLAYER`, you can use the `PLA PLAN REPLAYER LOAD 'file_name'; ``` -In the statement above, `file_name` is the name of the `ZIP` file to be exported. +In the statement above, `file_name` is the name of the `ZIP` file to be imported. For example: @@ -153,6 +153,16 @@ For example: PLAN REPLAYER LOAD 'plan_replayer.zip'; ``` +> **Note:** +> +> You need to disable auto analyze. Otherwise the imported statistics will be overwritten by analyze. + +You can disable auto analyze by setting the [`tidb_enable_auto_analyze`](/system-variables.md#tidb_enable_auto_analyze-new-in-v610) system variable to `OFF`: + +```sql +set @@global.tidb_enable_auto_analyze = OFF; +``` + After the cluster information is imported, the TiDB cluster is loaded with the required table schema, statistics and other information that affects the construction of the execution plan. You can view the execution plan and verify statistics in the following way: ```sql