Tidb_server Out Of Memory Quota

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

Original topic: tidb_server Out Of Memory Quota

| username: 等一分钟

[Test Environment for TiDB]
TiDB Version: 6.1.6
[Encountered Issue: Problem Description and Impact]
The memory limit has been changed to 4G, so why does executing an SQL still result in an Out Of Memory Quota error?
server_configs:
tidb:
log.file.max-backups: 7
log.file.max-days: 7
log.slow-threshold: 10000
mem-quota-query: 4294967296
performance.server-memory-quota: 62920851456

| username: zhanggame1 | Original post link

If the memory is sufficient, it can be increased further, for example to 8GB.

| username: 等一分钟 | Original post link

The image is not visible. Please provide the text you need translated.

| username: 等一分钟 | Original post link

This is a successfully executed SQL, occupying 1490M of memory.

| username: 等一分钟 | Original post link

| username: 等一分钟 | Original post link

Adding an extra column here results in an out of memory error.

| username: 等一分钟 | Original post link

I changed it to 4G, but the SQL shouldn’t be using up 4G, right?

| username: tidb菜鸟一只 | Original post link

The display here is inaccurate…

| username: 等一分钟 | Original post link

So where do I look?

| username: zhanggame1 | Original post link

It should be uncertain, just go with the major adjustment.

| username: 等一分钟 | Original post link

This way, the total memory of the server cannot be controlled.

| username: 等一分钟 | Original post link

Which of these two variables is it?

| username: 等一分钟 | Original post link

Changed to 8G and still getting an error.

| username: 像风一样的男子 | Original post link

At this point, you should optimize the SQL. Using such a large amount of memory is not normal.

| username: 等一分钟 | Original post link

When querying, adding an extra column, does it consume a lot of memory?

| username: 像风一样的男子 | Original post link

Check how much data your SQL execution plan has scanned.

| username: zhanggame1 | Original post link

What statement did you use to change it?

| username: 等一分钟 | Original post link

Which statement should be modified?
Just comment out one column in the query, and it will be normal.

| username: 等一分钟 | Original post link

This doesn’t look good, the execution plan has over 300 lines.

| username: 等一分钟 | Original post link

Will querying one more column consume that much more memory?