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

planner: add variables for instance plan cache #18830

Merged
merged 16 commits into from
Oct 15, 2024
39 changes: 39 additions & 0 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -2424,6 +2424,19 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
- Default value: `OFF`
- This variable controls whether Index Join is supported when the inner table has `Selection` or `Projection` operators on it. The default value `OFF` means that Index Join is not supported in this scenario.

### tidb_enable_instance_plan_cache <span class="version-mark">New in v8.4.0</span>

> **Warning:**
>
> Currently, Instance Plan Cache is an experimental feature. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.

- Scope: GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Boolean
- Default value: `OFF`
- This variable controls whether to enable the Instance Plan Cache feature. This feature implements instance-level execution plan cache, which allows all sessions within the same TiDB instance to share the execution plan cache, thereby improving memory utilization.
qw4990 marked this conversation as resolved.
Show resolved Hide resolved

### tidb_enable_ordered_result_mode

- Scope: SESSION | GLOBAL
Expand Down Expand Up @@ -3415,6 +3428,32 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified
- Unit: Rows
- This variable is used to set the number of rows for the initial chunk during the execution process. The number of rows for a chunk directly affects the amount of memory required for a single query. You can roughly estimate the memory needed for a single chunk by considering the total width of all columns in the query and the number of rows for the chunk. Combining this with the concurrency of the executor, you can make a rough estimation of the total memory required for a single query. It is recommended that the total memory for a single chunk does not exceed 16 MiB.

### tidb_instance_plan_cache_target_mem_size <span class="version-mark">New in v8.4.0</span>
qw4990 marked this conversation as resolved.
Show resolved Hide resolved

> **Warning:**
>
> Currently, Instance Plan Cache is an experimental feature. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.

- Scope: GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
- Default value: `104857600` (which is 100 MiB)
- This variable sets the target memory size for Instance Plan Cache. TiDB periodically cleans up the Instance Plan Cache in the background to ensure its memory usage does not exceed the value of this variable.
qw4990 marked this conversation as resolved.
Show resolved Hide resolved

### tidb_instance_plan_cache_max_mem_size <span class="version-mark">New in v8.4.0</span>

> **Warning:**
>
> Currently, Instance Plan Cache is an experimental feature. is an experimental feature. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.

- Scope: GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
- Default value: `125829120` (which is 120 MiB)
- This variable sets the maximum memory usage for Instance Plan Cache. This value must be greater than [`tidb_instance_plan_cache_target_mem_size`](#tidb_instance_plan_cache_target_mem_size-new-in-v840).
qw4990 marked this conversation as resolved.
Show resolved Hide resolved

### tidb_isolation_read_engines <span class="version-mark">New in v4.0</span>

> **Note:**
Expand Down
Loading