如何快速及时释放TIDB、TIKV占用内存

@spc_monkey @hey-hoho @来了老弟
经过PingCAP的同学耐心的指导和排查问题,如果发现有内存泄漏的问题,可以执行如下操作:
1、set global tidb_analyze_version = 1; //使用v1版本的 analyze
2、执行以下sql产生的语句:select distinct(concat('DROP STATS ',table_schema, '.', table_name,';')) from information_schema.tables, mysql.stats_histograms where stats_ver = 2 and table_id = tidb_table_id ;
3、步骤二产生的语句全部执行完后,确认stats_ver = 2以下语句没有内容,select distinct(concat(table_schema, '.', table_name)) from information_schema.tables, mysql.stats_histograms where stats_ver = 2 and table_id = tidb_table_id ;
4、重启tidb-server

经过上述步骤可以解决内存不断上涨的问题,据说5.1、5.2版本tidb-server部分环境可能会有这种现象,后续版本将进行改良优化

5 个赞