Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 关于tidb组件内存释放问题
[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed to encounter the issue
[Encountered Issue: Problem Phenomenon and Impact]
Recently, during testing, we found that some SQL queries cause the TiDB process to occupy a large amount of memory. After the SQL execution is complete, the occupied memory is not released immediately and takes some time. The question is, is there any pattern to the memory release of the TiDB process when it occupies a large amount of memory, or are there any parameters to control the release speed?
DC recycling defaults to every 10 minutes.
What is DC, is it GC? That one is for TiKV.
GC is a disk operation for Region, I am asking about the memory usage of the TiDB component.
There isn’t a good solution, we usually break down the SQL.
Recently, I found that some SQL queries cause the TiDB process to occupy a large amount of memory. After the SQL execution is complete, the occupied memory is not released immediately and takes some time. Is there any pattern to the memory release of the TiDB process, or are there any parameters to control the release speed?
During the execution of SQL statements in TiDB, to improve performance, a certain amount of memory is sometimes pre-allocated. After the SQL statement execution is complete, this pre-allocated memory is not released immediately but is retained for a period of time. You can try several parameters like tikv-buffer-size, tikv-buffer-pool-size, and tikv-buffer-pool.
I remember it won’t be released immediately.