You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: configure-memory-usage.md
+3-11
Original file line number
Diff line number
Diff line change
@@ -149,8 +149,8 @@ TiDB supports disk spill for execution operators. When the memory usage of a SQL
149
149
150
150
- The disk spill behavior is jointly controlled by the following parameters: [`tidb_mem_quota_query`](/system-variables.md#tidb_mem_quota_query), [`tidb_enable_tmp_storage_on_oom`](/system-variables.md#tidb_enable_tmp_storage_on_oom), [`tmp-storage-path`](/tidb-configuration-file.md#tmp-storage-path), and [`tmp-storage-quota`](/tidb-configuration-file.md#tmp-storage-quota).
151
151
- When the disk spill is triggered, TiDB outputs a log containing the keywords `memory exceeds quota, spill to disk now`or`memory exceeds quota, set aggregate mode to spill-mode`.
152
-
- Disk spill for the Sort, MergeJoin, and HashJoin operator is introduced inv4.0.0; disk spill for the HashAgg operator is introduced inv5.2.0.
153
-
- When the SQL executions containing Sort, MergeJoin, orHashJoin cause OOM, TiDB triggers disk spill by default. When SQL executions containing HashAgg cause OOM, TiDB does not trigger disk spill by default. You can configure the system variable `tidb_executor_concurrency = 1` to trigger disk spill for HashAgg.
152
+
- Disk spill for the Sort, MergeJoin, and HashJoin operators is introduced inv4.0.0; disk spill for the non-concurrent algorithm of the HashAgg operator is introduced inv5.2.0; disk spill for the concurrent algorithm of the HashAgg operator is introduced inv8.0.0.
153
+
- When the SQL executions containing Sort, MergeJoin, HashJoin, orHashAgg cause OOM, TiDB triggers disk spill by default.
154
154
155
155
>**Note:**
156
156
>
@@ -182,15 +182,7 @@ The following example uses a memory-consuming SQL statement to demonstrate the d
182
182
ERROR 1105 (HY000): Out Of Memory Quota![conn_id=3]
183
183
```
184
184
185
-
4. Configure the system variable `tidb_executor_concurrency` to 1. With this configuration, when out of memory, HashAgg automatically tries to trigger disk spill.
186
-
187
-
{{< copyable "sql">}}
188
-
189
-
```sql
190
-
SET tidb_executor_concurrency = 1;
191
-
```
192
-
193
-
5. Execute the same SQL statement. You can find that this time, the statement is successfully executed and no error message is returned. From the following detailed execution plan, you can see that HashAgg has used 600 MB of hard disk space.
185
+
4. Execute the same SQL statement. You can find that this time, the statement is successfully executed and no error message is returned. From the following detailed execution plan, you can see that HashAgg has used 600 MB of hard disk space.
Copy file name to clipboardExpand all lines: system-variables.md
+13
Original file line number
Diff line number
Diff line change
@@ -2010,6 +2010,19 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
2010
2010
- Default value: `OFF`
2011
2011
- This variable controls whether to enable TiDB to collect `PREDICATE COLUMNS`. After enabling the collection, if you disable it, the information of previously collected `PREDICATE COLUMNS` is cleared. For details, see [Collect statistics on some columns](/statistics.md#collect-statistics-on-some-columns).
2012
2012
2013
+
### tidb_enable_concurrent_hashagg_spill <span class="version-mark">New in v8.0.0</span>
2014
+
2015
+
>**Warning:**
2016
+
>
2017
+
> Currently, the feature controlled by this variable is experimental. It is not recommended that you use it in production environments. If you find a bug, you can report an [issue](https://github.com/pingcap/tidb/issues) on GitHub.
2018
+
2019
+
- Scope: SESSION | GLOBAL
2020
+
- Persists to cluster: Yes
2021
+
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
2022
+
- Type: Boolean
2023
+
- Default value: `ON`
2024
+
- This variable controls whether TiDB supports disk spill for the concurrent HashAgg algorithm. When it is `ON`, disk spill can be triggered for the concurrent HashAgg algorithm. This variable will be deprecated when this feature is generally available in a future release.
0 commit comments