Antelope与 Barracude MYSQL 文件格式
作者:吴炳锡 来源: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是支持压缩的。
Antelope与 Barracude MYSQL 文件格式的更多相关文章
- MySQL Antelope和Barracuda的区别分析
Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格式 支持 ...
- 【MySQL】数据行长度的一些限制
今天开发在导入数据的时候报一个错误: Row size too large. The maximum row size for the used table type, not counting BL ...
- Antelope 和Barracuda区别
Antelope是innodb-base的文件格式, Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格式 支 ...
- MySQL 5.5 服务器变量详解二(转)
add by zhj:在MySQL5.6中对一些参数有增删改,详见http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html ...
- MySQL数据库再回首
前言: 数据库是程序员的数据源泉,加上近期 要开发DB可视化.性能分析的功能 重新回顾一下MySQL知识,以下是笔记: MySQL架构 MySQL基础理论 1.什么是关系型数据库? 关系型数据库,这个 ...
- XtraDB/InnoDB的文件格式(已提交到MariaDB官方手册)
本文为mariadb官方手册:XtraDB/InnoDB File Format的译文. 原文:https://mariadb.com/kb/en/library/xtradbinnodb-file- ...
- MySQL 5.5 服务器变量详解(二)
innodb_adaptive_flushing={ON|OFF} 设定是否允许MySQL服务器根据工作负载动态调整刷写InnoDB buffer pool中的脏页的速率.动态调整刷写速率的目的在于避 ...
- InnoDB存储引擎介绍-(6) 一. Innodb Antelope 和Barracuda区别
分类 Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格式 ...
- mysql row size上限
mysql innodb 的 row size上限 背景 在项目使用中,出现了以下报错: Error Code: 1118 - Row size too large (> 8126). Chan ...
随机推荐
- 徐汉彬:Web系统大规模并发——电商秒杀与抢购
[导读]徐汉彬曾在阿里巴巴和腾讯从事4年多的技术研发工作,负责过日请求量过亿的Web系统升级与重构,目前在小满科技创业,从事SaaS服务技术建设. 电商的秒杀和抢购,对我们来说,都不是一个陌生的东西. ...
- *[topcoder]LittleElephantAndString
http://community.topcoder.com/stat?c=problem_statement&pm=12854&rd=15709 这道题DIV1 250的,还有点意思. ...
- Show username instead of "System Account" in SharePoint 2010
Problems: When I load my local SharePoint site, the account always show as "System Account" ...
- Android Binder设计与实现 - 设计篇
要 Binder是Android系统进程间通信(IPC)方式之一.Linux已经拥有管道,system V IPC,socket等IPC手段,却还要倚赖Binder来实现进程间通信,说明Binder具 ...
- [译]GotW #4 Class Mechanics
你对写一个类的细节有多在行?这条款不仅注重公然的错误,更多的是一种专业的风格.了解这些原则将会帮助你设计易于使用和易于管理的类. JG Question 1. 什么使得接口“容易正确使用,错误使用却很 ...
- Layout Resource官方教程(1)简介
Layout Resource SEE ALSO Layouts A layout resource defines the architecture for the UI in an Activit ...
- 转自 z55250825 的几篇关于FFT的博文(三)
题目大意:给出n个数qi,定义 Fj为 令 Ei=Fi/qi,求Ei. 其实这道题就是看到有FFT模板才觉得有必要学一下的... 所以实际上就是已经知道题解了... = ...
- [转] AC自动机详解
转载自:http://hi.baidu.com/nialv7/item/ce1ce015d44a6ba7feded52d AC自动机详解 AC自动机是用来处理多串匹配问题的,即给你很多串,再给你一篇文 ...
- C# 获取word批注信息
今天在Silverlight 应用程序中实现了 获取word文档批注信息 的功能. 在wcf服务继承接口类中编写的函数如下 /// <summary> /// 获取word批注信息 /// ...
- LightOJ 1245 Harmonic Number (II) 水题
分析:一段区间的整数除法得到的结果肯定是相等的,然后找就行了,每次是循环一段区间,暴力 #include <cstdio> #include <iostream> #inclu ...