我有一个巨大的InnoDB表,有三列(int,mediumint,int). innodb_file_per_table设置已打开,前两列只有一个PRIMARY KEY
表模式是:
CREATE TABLE `big_table` (
`user_id` int(10) unsigned NOT NULL,
`another_id` mediumint(8) unsigned NOT NULL,
`timestamp` int(10) unsigned NOT NULL,
PRIMARY KEY (`user_id`,`another_id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
MySQL版本是5.6.16
目前我每秒多插入超过150行.没有删除,也没有更新.
没有重大的回滚或其他事务中止,这将导致浪费的空间使用.
MySQL在该表上显示计算出的大小为75,7GB.
.ibd size on disc: 136,679,784,448 byte (127.29 GiB)
Counted rows: 2,901,937,966 (47.10 byte per row)
2天后,MySQL在该表上显示的计算大小为75.7 GB.
.ibd size on disc: 144,263,086,080 byte (135.35 GiB)
Counted rows: 2,921,284,863 (49.38 byte per row)
运行表的SHOW TABLE STATUS显示:
Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Collation
InnoDB | 10 | Compact | 2645215723 | 30 | 81287708672 | 0 | 0 | 6291456 | utf8_unicode_ci
这是我的问题:
>为什么光盘使用量与行数不成比例增长?
>为什么Avg_row_length和Data_length完全错误?
希望有人可以帮助我,光盘使用不再像这样增长.我没有注意到,因为桌子较小.