Antelope和Barracuda均爲innodb存儲引擎的文件格式,Antelope爲默認格式,非壓縮;Barracuda爲壓縮格式;二者主要的不一樣在於對大數據量的存儲時所佔用的空間差別。
若要使用innodb的壓縮功能,則必須使用innodb_file_format=Barracuda,否則沒有做用。
接下來以一組實驗來驗證這兩種不一樣存儲格式帶來的空間消耗差別。大數據
Antelope
create table t_antelope(id int primary key auto_increment not null,descirption varchar(20)) engine=innodb;this
delimiter $$
create procedure proc_antelope()
begin
declare i int;
set i = 1;
while i <= 1000000 do
insert into t_antelope values(i,'this is a test');
set i = i + 1;
end while;
end $$orm
Barracuda
create table t_barracuda(id int primary key auto_increment not null,descirption varchar(20)) engine=innodb row_format=compressed;ci
delimiter $$
create procedure proc_barracuda()
begin
declare i int;
set i = 1;
while i <= 1000000 do
insert into t_barracuda values(i,'this is a test');
set i = i + 1;
end while;
end $$rem
begin;call proc_antelope();commit;
begin;call proc_barracuda();commit;
實驗結果:
antelope格式的數據文件大小爲49M,數據插入時間18.42S,commit時間0.36S
barracuda格式的數據文件大小爲23M,數據插入時間55.9S,commit時間4.63Sit
可見Barracuda格式能夠節省不少空間,但數據插入處理過程的耗時也很是高io