Avg_row_length是怎么计算的?

通过一下命令我们可以获取表的使用情况:

root@mysql 05:49:33>show table status like 'tbname'\G

结果:

*************************** 1. row ***************************
           Name: tbname
         Engine: InnoDB
        Version: 10
     Row_format: Compact
           Rows: 3425
 Avg_row_length: 138
    Data_length: 475136
Max_data_length: 0
   Index_length: 1572864
      Data_free: 3145728
 Auto_increment: 6894011508
    Create_time: 2016-10-12 15:03:25
    Update_time: NULL
     Check_time: NULL
      Collation: utf8mb4_general_ci
       Checksum: NULL
 Create_options:
        Comment: NULL
1 row in set (0.00 sec)
Avg_row_length顾名思义是平均每行的长度,那么这个值是怎么获得的?
1. 因为InnoDB的行数是一个近似值 
2. 平均每行长度=数据大小/行数 
3. 大部分都是超过了每行的长度,因为在InnoDB的老版本中为了页对齐都自动的往上增加了,比如有一行行长29 bytes为了保证页对齐,往上加了1或2个bytes。 
4. 在经历了多次块分裂后, 认为块到达约69%的就满了 
参考资料:
http://forums.mysql.com/read.php?22,219129,224296#msg-224296

posted @ 2016-12-01 18:03  sunss  阅读(4652)  评论(0编辑  收藏  举报