Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 关于scan算子个数的疑问(tidb_distsql_scan_concurrency 无效?)
[TiDB Usage Environment] Production Environment
[TiDB Version] v6.1.1
[Reproduction Path] In the same TiDB environment with the same parameter settings, there is an SQL query where the actual scan operator is just 2, and it immediately goes OOM and then kills the SQL???
[Resource Configuration]
Memory Settings:
Single SQL memory limit: tidb_mem_quota_query is the default 1G
OOM action: tidb_mem_oom_action is the default CANCEL
Concurrency Settings:
set session tidb_distsql_scan_concurrency = 15; all are default values
SET session tidb_executor_concurrency = 5;
set session tidb_index_serial_scan_concurrency = 1;
[Encountered Problem: Problem Phenomenon and Impact]
Under normal circumstances, a single SQL:
SELECT * FROM ods.tp_pay_order LIMIT 3000000;
The result is like this: single memory exceeds the limit, then 15 operators are closed one by one, until the last operator, still exceeds, then kills the SQL.
However, another SQL:
The result is like this: single memory exceeds the limit, then 2 operators are closed instantly, until the last operator, still exceeds, then kills (at the time of the screenshot, I had already changed the OOM action to log, otherwise it would affect the business)
My question is, with the same parameter configuration, why does the second SQL behave like this, with only 2 operators??
Welcome experts to discuss~