mysql table optimization

A regular analysis table 

ANALYZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name]

Second, regular inspection table 

CHECK TABLE tbl_name [, tbl_name]  [option]

NOTE: CHECK TABLE can also check if there is an error view, such as in the view definition referenced table no longer exists.

 

Third, the periodic table optimization 

OPTIMIZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name]

OPTIMIZE TABLE only for MyISAM, BDB and InnoDB tables. For MyISAM tables, OPTIMIZE TABLE operation as follows: If the table has been deleted or decomposed rows, repair the table. If you do not index pages are classified, the classification. If the statistical data table is not updated (and the repair can not be achieved by the index classification) is updated. 

Note: Note that both ANALYZE, CHECK or OPTIMIZE table will be locked during execution, so please pay attention to these operations to be performed when the database is not busy.

Fourth, access to relevant information table 

show table status obtaining table information 
show table status like 'tableName' \ G
Name Table Name 

Engine table storage engine 

Version version 

Row_format 
line format. For MyISAM engine, which may be Dynamic, Fixed, or Compressed. Dynamic row line length 
variable, e.g. Varchar or Blob type field. A row is fixed constant row length, e.g. Char and Integer type word 
segment. 


Rows 
The number of rows in the table. For non-transactional tables, this value is accurate for transactional engine, this value is usually estimated. 


Avg_row_length 
average number of bytes per row comprising. 

Data_length 
data amount of the entire table (unit: bytes). 

 
Max_data_length 
table can accommodate the maximum amount of data. 

 
Index_length 
index footprint size of the disk. 

Data_free 
for MyISAM engine, identity has been allocated but unused space now, and includes space has been deleted rows. 

Auto_increment 
a lower value Auto_increment. 

Create_time 
create a time table. 

Update_time 
table last update time. 


Check_time 
using check table or myisamchk tool checklist of recent times.


Collation 
default character set and collation of the table. 

Checksum 
if enabled, when calculating the content of a table checksum. 

Create_options 
refers to all the other options at the time of table creation. 

Comment 
contains other additional information, for MyISAM engine, including a new comment Xu Biao, if the table using innodb engine, the remaining space reality table. If it is a view, which contains comments VIEW words.

Guess you like

Origin www.cnblogs.com/ivy-zheng/p/11121532.html