作者:吴炳锡 来源:http://www.mysqlsupport.cn/ 联系方式: wubingxi#163.com 转载请注明作/译者和出处,并且不能用于商业用途,违者必究.

Antelope是innodb-base的文件格式, Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式。两者区别在于:

文件格式 支持行格式 特性
Antelope

(Innodb-base)

ROW_FORMAT=COMPACT

ROW_FORMAT=REDUNDANT

Compact和redumdant的区别在就是在于首部的存存内容区别。

compact的存储格式为首部为一个非NULL的变长字段长度列表

redundant的存储格式为首部是一个字段长度偏移列表(每个字段占用的字节长度及其相应的位移)。

在Antelope中对于变长字段,低于768字节的,不会进行overflow page存储,某些情况下会减少结果集IO.

Barracuda

(innodb-plugin)

ROW_FORMAT=DYNAMIC

ROW_FORMAT=COMPRESSED

这两者主要是功能上的区别功能上的。 另外在行里的变长字段和Antelope的区别是只存20个字节,其它的overflow page存储。

另外这两都需要开启innodb_file_per_table=1

(这个特性对一些优化还是很有用的)

备注:

这里有一点需要注意,如果要使用压缩,一定需要先使用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;

+———+——+———————————————————————–+

| Level   | Code | Message                                                               |

+———+——+———————————————————————–+

| 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.                                  |

+———+——+———————————————————————–+

4 rows in set (0.00 sec)

从以上报错可以看出来不支持压缩。但看一下表结构如下:

(testing)root@localhost [wubx]> show create table t1;

+——-+———————————————————————————————————————————————–+

| Table | Create Table                                                                                                                                  |

+——-+———————————————————————————————————————————————–+

| t1    | CREATE TABLE t1 (

c1 int(11) NOT NULL,

PRIMARY KEY (c1)

) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 |

+——-+———————————————————————————————————————————————–+

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是支持压缩的。

转载于:https://www.cnblogs.com/zengkefu/p/5638802.html

Antelope与 Barracude MYSQL 文件格式相关推荐

  1. MySQL Antelope和Barracuda的区别分析

    (转载)Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格 ...

  2. mysql 5.5 barracuda_MySQL Antelope和Barracuda的区别分析

    Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格式 支持 ...

  3. barracuda mysql,MySQL Antelope和Barracuda的区别分析_MySQL

    Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格式 支持 ...

  4. mysql barracuda_MySQL Antelope和Barracuda的区别分析

    Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格式 支持 ...

  5. barracuda mysql_MySQL Antelope和Barracuda的区别分析

    Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格式 支持 ...

  6. mysql my.cnf配置

    [client] ######################################################################### #                 ...

  7. mysql 一行数据长度限制吗_【MySQL】行长度的一些限制

    标签: 今天开发在导入数据的时候报一个错误: Row size too large. The maximum row size for the used table type, not countin ...

  8. mysql.sock的问题

    关于mysql.sock的一些问题: 连接数据库时报错:Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2 ...

  9. MySQL 5.5 服务器变量详解(二)

    innodb_adaptive_flushing={ON|OFF} 设定是否允许MySQL服务器根据工作负载动态调整刷写InnoDB buffer pool中的脏页的速率.动态调整刷写速率的目的在于避 ...

  10. MySQL优化之大字段longtext、text引发的生产问题

    背景 对接多个外部接口,需要保存请求参数以及返回参数,方便消息的补偿,因为多个外部接口,多个接口字段都不统一,整体使用一个大字段(longtext)进行存储,但是当数据只有40w的时候查询速度就非常慢 ...

最新文章

  1. C++总结笔记(七)—— 运算符重载
  2. java quartz 数据库_SpringBoot+Quartz+数据库存储
  3. Python破解ZIP或RAR文件密码
  4. jsp,servlet交互驱动层实现
  5. JSK-387 求偶数和【入门】
  6. python关机_Python 神操作: 远程开机和关机
  7. 试卷分析计算机基础,计算机基础试卷分析.doc
  8. 韩立刚计算机网络笔记-第04章 数据链路层
  9. 由浅入深了解统计机器翻译模型
  10. pixhawk通信机制
  11. 用c语言写成电脑计时小程序
  12. Ice飞冰注意问题和可视化组件《三》
  13. 今天我被微软狠狠地雷翻了
  14. 浏览器打开本地exe
  15. When Observable completes without emitting, toPromise() will successfully resolve with undefined.
  16. JEC-QA:A Legal-Domain Question Answering Dataset 论文阅读
  17. 计算机网络WAN接口,网线插WAN口上不了网怎么办?
  18. 2020牛客暑期多校训练营(第八场)题解
  19. LeetCode - 771. Jewels and Stones
  20. 阿里浅尝元宇宙成功了吗?

热门文章

  1. Codeforces 1138
  2. 服务器和交换机物理连接_交换机发生网络通信故障怎么解决?
  3. AEMDA: Inferring miRNA-disease associations based on deep autoencoder
  4. 必做作业三_ShareX结构化原型设计
  5. Google APK下载
  6. 功能最强大的flv超酷网页播放器介绍flvPlayer
  7. 用AI制作高保真图片
  8. 记一次 黑软件 kthreaddi 攻防战
  9. 七夕节程序员应有的表白方式
  10. 如何给PDF文件加密?PDF文件加密操作步骤来了