mysql5.6 表碎片_mysql 表碎片

SELECT t.TABLE_SCHEMA,        t.TABLE_NAME,        t.TABLE_ROWS,   t.AVG_ROW_LENGTH ,  t.TABLE_ROWS*t.AVG_ROW_LENGTH as rr , t.DATA_LENGTH,        t.INDEX_LENGTH,  t.DATA_LENGTH + t.INDEX_LENGTH as contact_free   ,   concat(round(t.DATA_FREE / 1024 / 1024, 2), 'M') AS datafree FROM information_schema.tables t WHERE t.TABLE_SCHEMA = 'xxxxxxx' and t.TABLE_NAME='xxxxxxx';

mysql> show table from employees status like 't1'\G

*************************** 1. row ***************************

Name: t1

Engine: InnoDB

Version: 10

Row_format: Dynamic

Rows: 1176484

Avg_row_length: 86

Data_length: 101842944

Max_data_length: 0

Index_length: 0

Data_free: 39845888

Auto_increment: NULL

Create_time: 2018-08-28 13:40:19

Update_time: 2018-08-28 13:50:43

Check_time: NULL

Collation: utf8mb4_general_ci

Checksum: NULL

Create_options:

Comment:

1 row in set (0.00 sec)

碎片大小 = 数据总大小 - 实际表空间文件大小

数据总大小 = Data_length + Index_length = 101842944

实际表空间文件大小 = rows * Avg_row_length = 1176484 * 86 = 101177624

碎片大小 = (101842944 - 101177624) / 1024 /1024 = 0.63MB

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值