MySQL Antelope和Barracuda的区别分析
数据库  /  管理员 发布于 6年前   133
Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式。两者区别在于:
备注:
这里有一点需要注意,如果要使用压缩,一定需要先使用innodb_file_format =Barracuda格式,不然没作用。
下面我们看一下区别:
复制代码 代码如下:
(testing)root@localhost [(none)]> use wubx;
Database changed
(testing)root@localhost [wubx]> CREATE TABLE t1
-> (c1 INT PRIMARY KEY)
-> ROW_FORMAT=COMPRESSED
-> KEY_BLOCK_SIZE=8;
Query OK, 0 rows affected, 4 warnings (0.01 sec)
报出来4个warnings查看一下报错:
复制代码 代码如下:
(testing)root@localhost [wubx]> show warnings;
+―――+――+―――――――――――――――――――――――C+
| Level | Code | Message |
+―――+――+―――――――――――――――――――――――C+
| Warning | 1478 | InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. |
| Warning | 1478 | InnoDB: ignoring KEY_BLOCK_SIZE=8. |
| Warning | 1478 | InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. |
| Warning | 1478 | InnoDB: assuming ROW_FORMAT=COMPACT. |
+―――+――+―――――――――――――――――――――――C+
4 rows in set (0.00 sec)
从以上报错可以看出来不支持压缩。但看一下表结构如下:
复制代码 代码如下:
(testing)root@localhost [wubx]> show create table t1;
+――-+―――――――――――――――――――――――――――――――――――――――――――――――C+
| Table | Create Table |
+――-+―――――――――――――――――――――――――――――――――――――――――――――――C+
| t1 | CREATE TABLE t1 (
c1 int(11) NOT NULL,
PRIMARY KEY (c1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 |
+――-+―――――――――――――――――――――――――――――――――――――――――――――――C+
1 row in set (0.00 sec)
这个是比较坑的地方,所以在使用压缩需要注意。
复制代码 代码如下:
(testing)root@localhost [wubx]>create table t2 ( c1 int(11) NOT NULL, primary key(c1));
(testing)root@localhost [wubx]> insert into t2 select * from t1;
Query OK, 5417760 rows affected (37.12 sec)
Records: 5417760 Duplicates: 0 Warnings: 0
创建支持压缩的表:
复制代码 代码如下:
(testing)root@localhost [wubx]>SET GLOBAL innodb_file_per_table=1
(testing)root@localhost [wubx]>SET GLOBAL innodb_file_format=Barracuda;
(testing)root@localhost [wubx]>CREATE TABLE t3
(c1 INT PRIMARY KEY)
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;
(testing)root@localhost [wubx]> insert into t3 select * from t1;
Query OK, 5417760 rows affected (1 min 10.98 sec)
Records: 5417760 Duplicates: 0 Warnings: 0
看一下表的物理大小如下:
复制代码 代码如下:
-rw-rw―- 1 mysql mysql 8.4K Jul 5 16:58 t1.frm
-rw-rw―- 1 mysql mysql 136M Jul 5 19:40 t1.ibd
-rw-rw―- 1 mysql mysql 8.4K Jul 5 19:43 t2.frm
-rw-rw―- 1 mysql mysql 136M Jul 5 19:44 t2.ibd
-rw-rw―- 1 mysql mysql 8.4K Jul 5 19:46 t3.frm
-rw-rw―- 1 mysql mysql 96M Jul 5 19:47 t3.ibd
可见t1, t2都没进行压缩, t3是支持压缩的。
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号