From fc523d1265a212c5e1eafb807c779093e00f53a1 Mon Sep 17 00:00:00 2001 From: slzhou Date: Sun, 18 Jun 2023 07:53:35 +0800 Subject: [PATCH] fix: at most 128 k-way merge to decrease memory usage --- source/libs/executor/src/scanoperator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 42c0b88089..83aba6729b 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2787,8 +2787,8 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) { // the additional one is reserved for merge result // pInfo->sortBufSize = pInfo->bufPageSize * (tableEndIdx - tableStartIdx + 1 + 1); int32_t kWay = (TSDB_MAX_BYTES_PER_ROW * 2) / (pInfo->pResBlock->info.rowSize); - if (kWay >= 256) { - kWay = 256; + if (kWay >= 128) { + kWay = 128; } else if (kWay <= 2) { kWay = 2; } else {