首页 / 专栏 / mysql / 文章详情
【Mysql】innodb_space 的使用介绍
linda玲 发布于 2019-05-08
innodb_space 的git网址:https://github.com/jeremycole...
1、安装
# yum -y install ruby
# gem install innodb_ruby
安装完成后,执行如下命令验证innodb_ruby是否安装成功:# innodb_space --help
2、mysql环境
innodb_file_per_table=ON,innodb_file_format=Barracuda, innodb_file_format_max=Barracuda
3.基本用法
Against a single space file (ibdata or .ibd):
Option Parameters Description
-f <filename> Load the tablespace file (system or table)
Against a system tablespace which will auto-load file-per-table tablespace files:
Option Parameters Description
-s <filename> Load the system tablespace file (e.g. ibdata1)
-T <table name> Use the given table name.
-I <index name> Use the given index name
4.常用的用法
虽然每个innodb表都有frm文件,不过innodb在系统表空间中ibdata1也维护着innodb表的元数据,所以直接分析ibdata1文件即可了
解某个表的相关存储信息
表结构:
CREATE TABLE `aa` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '地区ID',
`name` varchar(20) NOT NULL DEFAULT '' COMMENT '名称',
`rel_id` varchar(50) NOT NULL DEFAULT '' COMMENT '关系ID',
`pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父ID',
`level` int(11) NOT NULL DEFAULT '0' COMMENT '类别,1、省份 2、市 3、区 4、县',
PRIMARY KEY (`id`),
UNIQUE KEY `UNQ_RID` (`rel_id`) USING BTREE,
KEY `IDX_PID` (`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='地区表'
1 row in set (0.00 sec)
表信息:
评论