亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

MySQL Antelope和Barracuda的區(qū)別分析

 更新時(shí)間:2014年07月22日 11:38:00   作者:吳炳錫  
這篇文章主要介紹了MySQL Antelope和Barracuda的區(qū)別分析,Antelope和Barracude都是一種文件格式,需要的朋友可以參考下

Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同時(shí)Barracude也支持Antelope文件格式。兩者區(qū)別在于:

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

(Innodb-base)

ROW_FORMAT=COMPACT

ROW_FORMAT=REDUNDANT

Compact和redumdant的區(qū)別在就是在于首部的存存內(nèi)容區(qū)別。

compact的存儲格式為首部為一個(gè)非NULL的變長字段長度列表

redundant的存儲格式為首部是一個(gè)字段長度偏移列表(每個(gè)字段占用的字節(jié)長度及其相應(yīng)的位移)。

在Antelope中對于變長字段,低于768字節(jié)的,不會進(jìn)行overflow page存儲,某些情況下會減少結(jié)果集IO.

Barracuda

(innodb-plugin)

ROW_FORMAT=DYNAMIC

ROW_FORMAT=COMPRESSED

 

這兩者主要是功能上的區(qū)別功能上的。 另外在行里的變長字段和Antelope的區(qū)別是只存20個(gè)字節(jié),其它的overflow page存儲。

另外這兩都需要開啟innodb_file_per_table=1

(這個(gè)特性對一些優(yōu)化還是很有用的)

備注:

這里有一點(diǎn)需要注意,如果要使用壓縮,一定需要先使用innodb_file_format =Barracuda格式,不然沒作用。

下面我們看一下區(qū)別:

復(fù)制代碼 代碼如下:

(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)


報(bào)出來4個(gè)warnings查看一下報(bào)錯(cuò):
復(fù)制代碼 代碼如下:

(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)

從以上報(bào)錯(cuò)可以看出來不支持壓縮。但看一下表結(jié)構(gòu)如下:

復(fù)制代碼 代碼如下:

(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)

這個(gè)是比較坑的地方,所以在使用壓縮需要注意。

復(fù)制代碼 代碼如下:

(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

創(chuàng)建支持壓縮的表:

復(fù)制代碼 代碼如下:

(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

看一下表的物理大小如下:

復(fù)制代碼 代碼如下:

-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都沒進(jìn)行壓縮, t3是支持壓縮的。

相關(guān)文章

最新評論