设置MySQL压缩表的步骤:
1、设置参数,同时修改配置文件。该参数不修改,不起作用。
set global innodb_file_format=Barracuda;
2、创建表时候,增加 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)