Which version of TiDB can limit the memory usage of a specific SQL query?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb哪个版本可以限制指定sql的内存使用大小?

| username: Hacker_QGgM2nks

【TiDB Usage Environment】Production Environment
【TiDB Version】v5.3.1
【Reproduction Path】TiDB OOM issue caused by large SQL
【Encountered Problem: TiDB OOM issue caused by large SQL, several TiDB instances keep restarting in a loop】

| username: Aaronz | Original post link

You should be referring to this global memory management feature. You can try upgrading to version 6.5 or later, and the [tidb_mem_quota_query] parameter should work.

| username: DBAER | Original post link

The tidb_mem_quota_query parameter seems to have been available since version 4, but the details are different. It’s still important to capture large SQL queries. You can check the dashboard’s top SQL and traffic pages.

| username: porpoiselxj | Original post link

v6.1.1 tidb_mem_quota_query combined with tidb_mem_oom_action

| username: 源de爸 | Original post link

| username: 小于同学 | Original post link

v6.1.1 tidb_mem_quota_query combined with tidb_mem_oom_action

| username: Aaronz | Original post link

This is session-based in 6.1, and I think its effect is not significant. It is globally controllable in 6.5.

| username: xiaoqiao | Original post link

It would be better to have more control after entering version 6.

| username: Hacker_QGgM2nks | Original post link

Thanks to everyone for their help, planning to upgrade the version!

| username: TIDB-Learner | Original post link

Query cache? This configuration has been deprecated in MySQL.

| username: xiaoqiao | Original post link

Refer to this article, preferably version 6 or above.

| username: Hacker_QGgM2nks | Original post link

No, it’s that the SQL query is consuming a large amount of memory. We need to control its usage, and if it reaches the threshold, kill it directly.

| username: Hacker_PtIIxHC1 | Original post link

You can set this parameter using tidb_mem_quota_query, which has been supported since version 4.0.

| username: 呢莫不爱吃鱼 | Original post link

It should be available after version 4.0.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.