From 7eb094beaab04a5d11d8fdfb94eafeece7e77d2b Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Mon, 23 Oct 2023 18:09:36 +0800 Subject: [PATCH] executor: fix an issue that index_lookup_hash_join incorrectly estimate memory usage. (#47795) (#47921) close pingcap/tidb#47788 --- executor/builder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/builder.go b/executor/builder.go index 14b415cf5419c..daa38d65a9141 100644 --- a/executor/builder.go +++ b/executor/builder.go @@ -4228,7 +4228,7 @@ func buildKvRangesForIndexJoin(ctx sessionctx.Context, tableID, indexID int64, l memTracker.Consume(int64(2 * cap(kvRanges[0].StartKey) * len(kvRanges))) } if len(tmpDatumRanges) != 0 && memTracker != nil { - memTracker.Consume(2 * int64(len(tmpDatumRanges)) * types.EstimatedMemUsage(tmpDatumRanges[0].LowVal, len(tmpDatumRanges))) + memTracker.Consume(2 * types.EstimatedMemUsage(tmpDatumRanges[0].LowVal, len(tmpDatumRanges))) } if cwc == nil { sort.Slice(kvRanges, func(i, j int) bool {