【TiDB 使用环境】生产环境 /测试/ Poc
【TiDB 版本】6.5.9
【操作系统】
【部署方式】云上部署(什么云)/机器部署(什么机器配置、什么硬盘)
【集群数据量】
【集群节点数】
【问题复现路径】做过哪些操作出现的问题
【遇到的问题:问题现象及影响】
sql:SELECT a.id AS id, b.filing_no, b.filing_time, b.patient_name, b.patient_phone, b.primary_disease, a.inspect_name AS inspectName, a.inspect_time AS inspectTime, a.inspect_source AS inspectSource, c.inspect_item AS inspectItem, c.result_grade AS resultGrade, c.is_normal AS isNormal, t1.member_name, t1.member_no, t1.card_no, CONCAT(LEFT(t1.member_mobile, 3), ‘****’, RIGHT(t1.member_mobile, 4)) AS memberMobile, bu.real_name AS createUserName, bu.code AS createUserCode, bu.code AS createNo, bu.dept_id AS deptId, bd.dept_code AS storeCode, bd.dept_name AS storeName, so.pq, so.fb, so.gs, so.dq FROM t_member_inspect a LEFT JOIN t_disease_filing b ON a.filing_id = b.id AND b.is_deleted = 0 AND b.tenant_id = ‘135490’ INNER JOIN (SELECT inspect_id, GROUP_CONCAT(inspect_item SEPARATOR ‘’) inspect_item, GROUP_CONCAT(result_grade SEPARATOR ’ ') result_grade, MIN(is_normal) is_normal FROM (SELECT inspect_id, result_grade, CONCAT(result_item, ': ‘, result_value, ’ ‘, unit, ‘;’) inspect_item, is_normal FROM t_new_member_inspect_item WHERE tenant_id = ‘135490’) t1 GROUP BY inspect_id) c ON c.inspect_id = a.id INNER JOIN t_member t1 ON a.member_id = t1.id AND t1.tenant_id = ‘135490’ INNER JOIN blade_user bu ON a.create_user = bu.id INNER JOIN blade_dept bd ON bd.id = a.create_dept LEFT JOIN v_sy_organ so ON so.autocode = bd.dept_code WHERE 1 = 1 AND (bd.ancestors LIKE concat(’%’, 1801298987277758466, ‘%’) OR bd.id = 1801298987277758466) AND a.inspect_time >= ‘2025-06-01+00:00:00’ AND a.inspect_time <= ‘2025-06-26+23:59:59’ AND a.is_deleted = 0 AND a.tenant_id = ‘135490’ limit 10000
上述sql执行可以查出结果,总数为9781。
在去除 limit 10000后,报错:
Your query has been cancelled due to exceeding the allowed memory limit for a single SQL query. Please try narrowing your query scope or increase the tidb_mem_quota_query limit and try again.[conn=2715545231010197741]
【资源配置】进入到 TiDB Dashboard -集群信息 (Cluster Info) -主机(Hosts) 截图此页面
【复制黏贴 ERROR 报错的日志】
【其他附件:截图/日志/监控】