TiDB Memory Overflow

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

Original topic: tidb内存爆满

| username: 等一分钟

The tidb_server node often causes the server to freeze due to memory overload, and the server can only be restarted. After canceling the swap, the tidb_server process will be killed and restarted due to OOM, which slightly alleviates the issue.

Will adding a tiflash node improve the situation?

| username: h5n1 | Original post link

Using tilfash to improve still requires analyzing specific SQL. You need to first identify the SQL that consumes a lot of memory, and then analyze it. What is the tidb_mem_quota_query variable set to? This variable currently sets the maximum memory for a single SQL (not necessarily 100% effective).

| username: 等一分钟 | Original post link

tidb_mem_quota_query=524288000
This should be the default value.

| username: porpoiselxj | Original post link

The tidb_mem_quota_query parameter should be used in conjunction with tidb_mem_oom_action. Setting it to cancel means that a single session will be automatically killed when it exceeds the memory limit.

| username: TiDBer_CEVsub | Original post link

It is recommended that the configuration for adjusting the block size should not exceed 60% of the machine’s memory. After making the adjustments, restart the TiKV node.

| username: zhouzeru | Original post link

There definitely needs to be some optimization operations, try adding one.

| username: tracy0984 | Original post link

I am also very concerned about how to solve this problem. After your issue is resolved, could you reply with the solution? Thanks a lot~~

| username: 等一分钟 | Original post link

May I ask what is the command to refresh the configuration to the configuration file after using set global?