我有一个巨大的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;
Run Code Online (Sandbox Code Playgroud)
MySQL版本是5.6.16
目前我每秒多插入超过150行.没有删除,也没有更新.没有重大的回滚或其他事务中止,这将导致浪费的空间使用.
MySQL在该表上显示计算出的大小为75,7GB.
光盘上的.ibd大小:136,679,784,448字节(127.29 GiB)
计数行:2,901,937,966(每行47.10字节)
2天后,MySQL在该表上显示的计算大小为75.7 GB.
光盘上的.ibd大小:144,263,086,080字节(135.35 GiB)
计数行:2,921,284,863(每行49.38字节)
跑步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 | …
Run Code Online (Sandbox Code Playgroud)