pingcap/tidb

Support spilling for distinct aggregate function

Open

#27.092 aperta il 11 ago 2021

Vedi su GitHub
 (4 commenti) (0 reazioni) (1 assegnatario)Go (6186 fork)batch import
help wantedsig/executiontype/enhancement

Metriche repository

Star
 (40.090 star)
Metriche merge PR
 (Merge medio 14g 4h) (346 PR mergiate in 30 g)

Descrizione

Enhancement

Although we support spilling for unparallel HashAgg now, the memory usage of distinct is also out of control. The reason is that we need a IntSet/FloatSet/StringSet to check whether a value is distinct, and the Set maybe take up huge memory.

We need some spilling strategy for distinct function, to control the memory usage of SQL included distinct function.

Fortunately, only few aggregate function need to support distinct, so we only need consider the following distinct function: Count, Sum, Avg, GroupConcat

TiDB seems also support distinct for STDDEV_POP,STDDEV_SAMP, etc. But Mysql doesn't support the syntax

Guida contributor