How does MySQL calculate the table size?
@ Forandever 2011-11-11
Use SQL statements:
Show table status from dbname where name = 'tbname' and update_time> 20111111;
Returned array:
Name: tbname table name
Engine: MyISAM | InnoDB (Table store engine)
Version: Version X
Row_format: Row format
Rows: Total number of rows in the table
Avg_row_length: Average size of each row
Data_length: the total size of the data file in bytes.
Max_data_length: Maximum length of the data file. If the storage engine is InnoDB, the value displayed in show table status is always 0.
Index_length: Index size
Data_free: the number of bytes in an integer but not in use.
Auto_increment: auto-increment ID, next auto_increment Value
Create_time: Table Creation Time
Update_time: The Last Update Time of the data file.
Check_time: The last time the table was checked. Not all storage engines are updated at this time. In this case, the value is null.
Collation: Encoding
Checksum:
Create_options: row_format = dynamic, which is used together with CREATE TABLE
Comment: Comment
Database size = table structure + Table Data + Index = data_length + index_length
@ Forever 2011-11-11