在生产环境,有一张大表,大约60G,表里记录数据很少,只有24W条,但是表里有大字段类型: `
mediumtext,然后analyz收集此表统计信息时,就一直失败,报以下错误,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=2753177115951103]。
经过排查,发现官方tidb_analyze_skip_column_types参数默认值给用户埋了一个坑。因为默认参数里只添加了blob类型,没有text类型,也是挺无语的,不知道咋想的。
用以下语句修改参数值:
set global tidb_analyze_skip_column_types=‘json,blob,mediumblob,longblob,text,mediumtext,longtext’;
统计任务立刻恢复,tidb的内存使用也恢复正常。