Release UnionAll sub-queries internal memory usages as soon as possible
Open
type/enhancement
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
Currently, memory allocated inside executors are not released until their "Close" functions are called. It works properly for most cases, since it won't last too long time. However, for union all cases, the "Close" functions of all the executors inside the sub-queries won't be called until the whole query is closed. This will increase the minimal memory usage of the query, for example:
Union all with 20 subqueries, each one consumes about 50M
If we execute these subqueries with concurrency 1, then the whole memory usage will be about 50M. But now, the whole memory usage will be about 50 * 20 M = 1G.
Contributor guide
Assessment
This issue has not been assessed yet.