【TiDB 使用环境】生产环境
【TiDB 版本】v7.1.5
【部署方式】物理机部署
【操作系统/CPU 架构/芯片详情】
【机器部署详情】CPU大小/内存大小/磁盘大小
【集群数据量】~6T
【集群节点数】7 KV节点
【问题复现路径】做过哪些操作出现的问题
【遇到的问题:问题现象及影响】
最近也不算是最近之前也出现过,最近变的频繁, 我们有个导数据的服务,可以简单理解为把数据从TIDB导出来然后写入下游 数仓里。
问题就发生在这个服务从tidb导出数据的时候 报超内存的报错 :
pymysql.err.OperationalError: (1105, '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=7465758719392460341]')
TIDB默认的单SQL内存是1G ,我已经改成了3G;
但主要问题是通过explain看 这个SQL实际占用的内存并没有超过3G,为什么会报超内存了呢?是不是BUG还是我理解有问题,谢谢各位大佬解惑
以下是一个报错SQL desc 结果:
> desc SELECT xpost.postid, xpost.facetid, xpost.entryid, xpost.title, xpost.url, xpost.abstract, xpost.click, xpost.reply, xpost.repost, xpost.praise, xpost.collect, xpost.watch, xpost.wordscount, xpost.keywordcount, xpost.siteid, xpost.domain, xpost.author, xpost.author_id, xpost.posttime, xpost.include_t, xpost.type, xpost.source, xpost.hidden, xpost.sourcetype, xpost.crisis_post, xpost.ontop, xpost.type_rank, xpost.noise_rank, xpost.device, xpost.is_origin, xpost.is_top, xpost.media_type, xpost.author_type, xpost.content_type, xpost.client_type, xpost.industry, xpost.tags, xpost.post_type, xpost.type_reason, xpost.update_time, xpost.origin_source, xpost.media_id, xpost.w_level, xpost.sid, xpost.location, xpost.is_comment, xpost.pos_type_rank, xpost.text, xpost.spider_time, xpost.process_time, xpost.tidb_in_time, xpost.is_yqt, xpost.fans_num, xpost.gender, xpost.author_location, xpost.verify_info, xpost.author_tags, xpost.is_ocr, xpost.signature, xpost.api_call_num, xpost.api_call_time, xpost.extra_str_1, xpost.extra_str_2, xpost.extra_str_3, xpost.extra_str_4, xpost.extra_str_5, xpost.extra_str_6, xpost.extra_str_7, xpost.extra_str_8, xpost.extra_text_1, xpost.extra_int_1, xpost.extra_int_2, xpost.extra_int_3, xpost.extra_float_1, xpost.extra_float_2, xpost.extra_float_3, xpost.media_industry, xpost.cluster_id, xpost.parent_url, xpost.personal_sourcetype, xpost.personal_domain, xpost.server_info FROM xpost WHERE NOT (xpost.tidb_in_time >= '2026-01-02 00:00:00' AND xpost.tidb_in_time <= '2026-01-03 03:59:59') AND xpost.facetid = 691 AND xpost.update_time >= '2026-01-02 03:06:39' AND xpost.update_time < '2026-01-02 06:13:18' ORDER BY xpost.update_time;
+----------------------------------+---------+-----------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+----------------------------------+---------+-----------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Projection_29 | 4673.65 | root | | bsppr.xpost.postid, bsppr.xpost.facetid, bsppr.xpost.entryid, bsppr.xpost.title, bsppr.xpost.url, bsppr.xpost.abstract, bsppr.xpost.click, bsppr.xpost.reply, bsppr.xpost.repost, bsppr.xpost.praise, bsppr.xpost.collect, bsppr.xpost.watch, bsppr.xpost.wordscount, bsppr.xpost.keywordcount, bsppr.xpost.siteid, bsppr.xpost.domain, bsppr.xpost.author, bsppr.xpost.author_id, bsppr.xpost.posttime, bsppr.xpost.include_t, bsppr.xpost.type, bsppr.xpost.source, bsppr.xpost.hidden, bsppr.xpost.sourcetype, bsppr.xpost.crisis_post, bsppr.xpost.ontop, bsppr.xpost.type_rank, bsppr.xpost.noise_rank, bsppr.xpost.device, bsppr.xpost.is_origin, bsppr.xpost.is_top, bsppr.xpost.media_type, bsppr.xpost.author_type, bsppr.xpost.content_type, bsppr.xpost.client_type, bsppr.xpost.industry, bsppr.xpost.tags, bsppr.xpost.post_type, bsppr.xpost.type_reason, bsppr.xpost.update_time, bsppr.xpost.origin_source, bsppr.xpost.media_id, bsppr.xpost.w_level, bsppr.xpost.sid, bsppr.xpost.location, bsppr.xpost.is_comment, bsppr.xpost.pos_type_rank, bsppr.xpost.text, bsppr.xpost.spider_time, bsppr.xpost.process_time, bsppr.xpost.tidb_in_time, bsppr.xpost.is_yqt, bsppr.xpost.fans_num, bsppr.xpost.gender, bsppr.xpost.author_location, bsppr.xpost.verify_info, bsppr.xpost.author_tags, bsppr.xpost.is_ocr, bsppr.xpost.signature, bsppr.xpost.api_call_num, bsppr.xpost.api_call_time, bsppr.xpost.extra_str_1, bsppr.xpost.extra_str_2, bsppr.xpost.extra_str_3, bsppr.xpost.extra_str_4, bsppr.xpost.extra_str_5, bsppr.xpost.extra_str_6, bsppr.xpost.extra_str_7, bsppr.xpost.extra_str_8, bsppr.xpost.extra_text_1, bsppr.xpost.extra_int_1, bsppr.xpost.extra_int_2, bsppr.xpost.extra_int_3, bsppr.xpost.extra_float_1, bsppr.xpost.extra_float_2, bsppr.xpost.extra_float_3, bsppr.xpost.media_industry, bsppr.xpost.cluster_id, bsppr.xpost.parent_url, bsppr.xpost.personal_sourcetype, bsppr.xpost.personal_domain, bsppr.xpost.server_info |
| └─IndexLookUp_33 | 4673.65 | root | | |
| ├─IndexRangeScan_30(Build) | 5169.40 | cop[tikv] | table:xpost, index:idx_facetid_update_time(facetid, update_time) | range:[691 2026-01-02 03:06:39,691 2026-01-02 06:13:18), keep order:true |
| └─Selection_32(Probe) | 4673.65 | cop[tikv] | | or(lt(bsppr.xpost.tidb_in_time, 2026-01-02 00:00:00.000000), gt(bsppr.xpost.tidb_in_time, 2026-01-03 03:59:59.000000)) |
| └─TableRowIDScan_31 | 5169.40 | cop[tikv] | table:xpost | keep order:false |
+----------------------------------+---------+-----------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
5 rows in set (0.00 sec)
【资源配置】进入到 TiDB Dashboard -集群信息 (Cluster Info) -主机(Hosts) 截图此页面
【复制黏贴 ERROR 报错的日志】
【其他附件:截图/日志/监控】


