show stats_healthy的信息有对应的元信息表吗?

show stats_healthy的信息有对应的元信息表吗?或者show stats_healthy能支持order by吗?

在mysql 库下面有一个stats_metastats_meta表。不支持order by ,但是可以用where 条件来过滤

这也可以

show stats_healthy where Healthy <100

不支持order by,健康度计算方式是根据修改行数/总行数的对比来的。

stats_meta表的table_id,如何获取具体的表名?

select table_name,TIDB_TABLE_ID from information_schema.tables

tables里面有

select t.TABLE_SCHEMA,t.table_name,m.* from mysql.stats_meta m,information_schema.tables t where table_id = TIDB_TABLE_ID and TABLE_SCHEMA='test' and table_name='t';

:+1: :+1: :+1:

表的健康度信息

通过 SHOW STATS_HEALTHY 可以查看表的统计信息健康度,并粗略估计表上统计信息的准确度。当 modify_count >= row_count 时,健康度为 0;当 modify_count < row_count 时,健康度为 (1 - modify_count/row_count) * 100。

根据官方文档的解释,对于非分区表,可以通过如下sql对表的健康度进行排序
select t.TABLE_SCHEMA,t.table_name,m.table_id, floor(if(m.modify_count >= m.count, 0, (1-m.modify_count/m.count)*100)) healthy from mysql.stats_meta m,information_schema.tables t where table_id = TIDB_TABLE_ID and TABLE_SCHEMA=‘xxxxxxxxxx’ order by healthy;

分区表的还不清楚如何获取健康度

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。