pingcap / pingcap/tidb

hashJoin,NLJoin当左表一条记录可以匹配右表大批记录时容易OOM

Open
#38,384 2 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
看这里的代码,当做hashjoin的时候probe表选择一条记录时候,build表如果有大批量结果集匹配到那么没有被内存追踪到,不能落盘,容易引起OOM,可以通过select * from a(少量记录) cross join b(百万或者千万记录)走hashjoin来模拟此行为。
对于hashjoin怀疑和方法:func (c *hashRowContainer) GetMatchedRowsAndPtrs中的matched = append(matched, matchedRow)没有consume有关。

[https://github.com/pingcap/tidb/blob/master/executor/hash_table.go#:~:text=matched%20%3D%20append(matched%2C%20matchedRow)](url)

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.