您的位置:首页 > 数据库 > MariaDB

MariaDB的Aria存储引擎

2016-03-07 17:37 856 查看
# Aria存储引擎

Aria是MariaDB的一个全新的存储引擎,它是作为MyISAM存储引擎的替代者而开发的。

它的特点:

1. 拥有自动恢复功能

2. 比MyISAM更好的缓存系统,相对于MyISAM有一定提升。

3. 未来版本可能会支持事务。

# 本文版本:

10.1.12-MariaDB

# Aria的相关参数

TRANSACTION = 0 | 1

PAGE_CHECKSUM = 0| 1

TABLE_CHECKSUM = 0 | 1

ROW_FORMAT = PAGE // Aria存储引擎除了支持MyISAM的所有行格式(FIXED和DYNAMIC) 外,还支持页模式的行格式。页模式只有在TRANSACTION=1的时候才会生效。在Aria缓存机制中,页模式下缓存的是一个个的页。

# 创建aria表

MariaDB [test]> create table t1(a int) row_format=fixed transactional=0 page_checksum=0;
Query OK, 0 rows affected, 2 warnings (0.01 sec)
MariaDB [test]> show warnings;
+---------+------+------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                            |
+---------+------+------------------------------------------------------------------------------------+
| Warning | 1478 | Table storage engine 'InnoDB' does not support the create option 'TRANSACTIONAL=1' |
| Warning | 1478 | InnoDB: assuming ROW_FORMAT=COMPACT.                                               |
+---------+------+------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
MariaDB [test]> create table t1(a int) row_format=fixed transactional=0 page_checksum=0 engine=aria;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> show create table t1;
+-------+------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                       |
+-------+------------------------------------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=Aria DEFAULT CHARSET=utf8 PAGE_CHECKSUM=0 ROW_FORMAT=FIXED TRANSACTIONAL=0 |
+-------+------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

# Aria的优点

1. Aria的数据和索引具有崩溃恢复功能,如果发生崩溃,Aria会回滚到命令执行前的状态。

2. Aria能重放事务日志中的所有内容。但有些操作不能重放,比如load data infile、slect...insert等。

3. 支持对一张表的并发插入操作。

4. 当使用页格式时,数据缓存在页缓存中。

参考书籍:《MariaDB原理与实现》
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mariadb aria