TiDB 5.4 Error When Executing Complex SQL

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

Original topic: tidb5.4 执行复杂sql报错

| username: hyman

If you want to permanently solve the problem, currently it is found that you can only change the memory of a single SQL query under the session variable tidb_mem_quota_query.

| username: tidb狂热爱好者 | Original post link

If the memory causes OOM, the SQL should be modified.

| username: hyman | Original post link

Increasing the tidb_mem_quota_query memory allows the query to be executed. The database is currently used for querying, so theoretically, the SQL cannot be changed.

| username: tidb狂热爱好者 | Original post link

The following two statements equivalently change a Session variable

SET tidb_distsql_scan_concurrency = 10;
SET SESSION tidb_distsql_scan_concurrency = 10;

The following two statements equivalently change a Global variable

SET @@global.tidb_distsql_scan_concurrency = 10;
SET GLOBAL tidb_distsql_scan_concurrency = 10;

You just need to use the global keyword in front to set it.

| username: hyman | Original post link

tidb_mem_quota_query seems to be session-level only.

| username: tidb狂热爱好者 | Original post link

I often use it at the instance level.

| username: hyman | Original post link

I encountered an error when using set global.

| username: tidb狂热爱好者 | Original post link

Upgrade TiDB to 6.1 or set the mem-quota-query parameter in the tidbconfig configuration.

| username: zhanggame1 | Original post link

Please provide the error message.

| username: redgame | Original post link

Later, was this configured: mem-quota-query?