Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: check sql oom
[TiDB Usage Environment] Production Environment / Testing / Poc
[TiDB Version]
[Reproduction Path] What operations were performed that led to the issue
[Encountered Issue: Problem Phenomenon and Impact] How to predict in advance that a query’s SQL will cause OOM
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachment: Screenshot/Logs/Monitoring]
It is not possible to predict the memory usage of SQL in advance. You can set a memory usage limit for a single session using tidb_mem_quota_query.
If this value is exceeded, will the query process be automatically killed, thus preventing the system from running out of memory (OOM)?
It is not possible to predict how much memory a specific SQL will use.
First, you can set the tidb_mem_quota_query
to a smaller value to reduce the likelihood of the TiDB instance running out of memory (OOM).
Then, for SQL-level OOM adjustments, you can optimize the SQL, allow a specific SQL to use more memory, or use disk spilling to solve the OOM issue.
Although it is not possible to judge in advance, it is possible to make a rough judgment based on the amount of data returned or changed by TiDB, such as updating a large amount of data or joining a large amount of data.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.