pingcap / pingcap/tidb

Release UnionAll sub-queries internal memory usages as soon as possible

Open
#59,473 0 comments 1 reaction 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.