gpt4 book ai didi

mysql - 如何在 Aria(MariaDB) 中启用事务?

转载 作者:行者123 更新时间:2023-11-29 03:02:54 25 4
gpt4 key购买 nike

我是 MySQL 和 MariaDB 的新手。我用 mariadb 替换了 mysql 并且遇到了事务问题。

MariaDB [(none)]> show engines;
+--------------------+---------+--------------+------+------------+
| Engine | Support | Transactions | XA | Savepoints |
+--------------------+---------+--------------+------+------------+
| MyISAM | YES | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | NO | NO | NO |
| Aria | YES | NO | NO | NO |
| InnoDB | DEFAULT | YES | YES | YES |
+--------------------+---------+--------------+------+------------+

MariaDB [(none)]> create table test (id INT) ENGINE=ARIA TRANSACTIONAL=1


BEGIN;
INSERT INTO test VALUES (1);
ROLLBACK;

WARNING:some non-transactional changed tables couldn't be rolled back

最佳答案

Aria 存储引擎目前不是事务性的。来自MariaDB site :

TRANSACTIONAL is only applicable for Aria tables. In future Aria tables created with this option will be fully transactional, but currently this provides a form of crash protection.

Aria 计划在未来成为事务性的,但这不是优先事项。同样来自 MariaDB site :

For the moment, Aria 2.0 is on hold as the developers are focusing their main efforts on improving MariaDB.

如果您需要一个表是事务性的,请使用 InnoDB 存储引擎(实际上是 XtraDB )。如果您要替换需要事务的现有安装,则旧表必须是 InnoDB,因为 MyISAM 是非事务性的。

关于mysql - 如何在 Aria(MariaDB) 中启用事务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20430525/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com