查询和删除数据报错

【 TiDB 使用环境】生产环境
【 TiDB 版本】8.0.11-TiDB-v8.1.2
【遇到的问题:问题现象及影响】
查询报错:
执行一个查询语句,数据量大概在110万条,执行这个语句时报错:SQL 错误 [8176] [HY000]: Your query has been cancelled due to exceeding the allowed memory limit for the tidb-server instance and this query is currently using the most memory. Please try narrowing your query scope or increase the tidb_server_memory_limit and try again.[conn=577335112]

删除报错
24-06-2025 00:01:22 CST ods_fms_barcodes_i-3056 INFO - 2025-06-24 00:01:22.464 [job-0] ERROR JobContainer - Exception when job run
24-06-2025 00:01:22 CST ods_fms_barcodes_i-3056 INFO - com.alibaba.datax.common.exception.DataXException: Code:[DBUtilErrorCode-07], Description:[读取数据库数据失败. 请检查您的配置的 column/table/where/querySql或者向 DBA 寻求帮助.]. - 执行的SQL为: delete from
24-06-2025 00:01:22 CST ods_fms_barcodes_i-3056 INFO - db_13bu_ods.ods_fms_barcodes_i
24-06-2025 00:01:22 CST ods_fms_barcodes_i-3056 INFO - where
24-06-2025 00:01:22 CST ods_fms_barcodes_i-3056 INFO - CREATE_TIME >= STR_TO_DATE(‘20250605083000’, ‘%Y%m%d%H%i%s’)
24-06-2025 00:01:22 CST ods_fms_barcodes_i-3056 INFO - and CREATE_TIME < STR_TO_DATE(‘20250605113000’, ‘%Y%m%d%H%i%s’) 具体错误信息为:java.sql.SQLException: Your query has been cancelled due to exceeding the allowed memory limit for the tidb-server instance and this query is currently using the most memory. Please try narrowing your query scope or increase the tidb_server_memory_limit and try again.[conn=577220806]

【资源配置】
10台服务器,出tiflash服务器是128G,其他都是64G,硬盘都是SSD

是查询跟删除导致内存使用超过了这个变量的值,然后被cancel了。
show variables 先看下这个变量的值是多少,有没有调整过

多谢,我设置为 24G 了,之前查询报错的可以了

1 个赞

如果这个主机上除了pd跟tidb没有其他服务的话,可以使用默认值80%。
设置了24G的话,剩下的主机内存就用不到了,有点浪费

:flushed:我们设置的10G,看样子也得调大才行。

不差内存设置20G也没问题

学习了