設(shè)置MySQL壓縮表的步驟:
1至耻、設(shè)置參數(shù),同時(shí)修改配置文件兔毙。該參數(shù)不修改,不起作用兄春。
set global innodb_file_format=Barracuda;
2澎剥、創(chuàng)建表時(shí)候,增加?row_format=COMPRESSED KEY_BLOCK_SIZE=8
3赶舆、查看壓縮表:
>show table status like 'user_device_info'\G
*************************** 1. row ***************************
? ? ? ? ? Name: user_device_info
? ? ? ? Engine: InnoDB
? ? ? ? Version: 10
? ? Row_format: Compressed ? ? ? # 注意注意這里
? ? ? ? ? Rows: 70756484
Avg_row_length: 172
? ? Data_length: 12238454784
Max_data_length: 0
? Index_length: 6180831232
? ? ? Data_free: 3670016
Auto_increment: NULL
? ? Create_time: 2018-05-17 14:44:59
? ? Update_time: NULL
? ? Check_time: NULL
? ? ? Collation: utf8_general_ci
? ? ? Checksum: NULL
Create_options: row_format=COMPRESSED KEY_BLOCK_SIZE=8
? ? ? ? Comment:
1 row in set (0.00 sec)