Skip to content

innodb_table_stats

xiaoboluo768 edited this page Jun 7, 2020 · 2 revisions
  • 该表提供查询表数据相关的统计信息
  • 表结构定义
CREATE TABLE `innodb_table_stats` (
  `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `table_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `n_rows` bigint(20) unsigned NOT NULL,
  `clustered_index_size` bigint(20) unsigned NOT NULL,
  `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`database_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
  • 表字段含义
  • database_name:数据库名称
  • table_name:表名、分区名或子分区名称
  • last_update:表示InnoDB上次更新此统计信息行的时间戳
  • n_rows:表中的估算数据记录行数
  • clustered_index_size:主键索引的大小,以页为单位的估算数值
  • sum_of_other_index_sizes:其他(非主键)索引的总大小,以页为单位的估算数值
  • 表记录内容示例
root@localhost : test 08:00:46> use mysql
Database changed
root@localhost : mysql 08:01:30> select * from innodb_table_stats where table_name='test'\G
*************************** 1. row ***************************
           database_name: test
              table_name: test
             last_update: 2018-05-24 20:00:50
                  n_rows: 6
    clustered_index_size: 1
sum_of_other_index_sizes: 2
1 row in set (0.00 sec)

上一篇:统计信息表 |下一篇:innodb_index_stats表

Clone this wiki locally