Home >Database >Mysql Tutorial >轻量级数据库比较:SQLite、H2 和 MySQL Embedded

轻量级数据库比较:SQLite、H2 和 MySQL Embedded

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:16:083013browse

对 PHP程序员来说,SQLite可以快速的搭建数据库开发环境,提供轻松、自容器、无配置、无独立服务的数据库环境,所有数据保存在一

对 PHP程序员来说,SQLite可以快速的搭建数据库开发环境,提供轻松、自容器、无配置、无独立服务的数据库环境,所有数据保存在一个文件里。当使用 MySQL 作为最终生产平台时,SQLite 是不可替代的开发环境解决方案。但真的没有其他兼容性更好的选择了吗?好吧,仅举几个原因:MySQL的兼容性和支持哈希索引,还不止这些!

当我们寻找 SQLite 的替代方案时,有两个可选,,分别是 H2 和 MySQL Embeded 版本。我关注的是可像 SQLite 一样方便使用,但又必须兼容 MySQL。

下面我们对三个数据库进行简单的比较:

比较项目
SQLite H2 database engine MySQL Embedded

Footprint 350KiB

授权协议
Public domain Dual: Modified MPL 1.1 / EPL 1.0 (commercial friendly) GPL 2.0 (only commercial friendly if not redistributed)

自容器

单文件

无服务器

服务器模式

零配置

事物处理

索引 (B-tree, R-tree, full-text) (B-tree, tree, hash, full-text) (B-tree, R-tree, hash, full-text)

MySQL 兼容性
(but not 100%)

兼容其他数据库 MySQL, PostgreSQL, Oracle, MSSQL, DB2, HSQLDB and Derby

加密

内存中数据库
(MEMORY storage engine)

 

看似 H2 管理最简单,因此我在 PHP 下体验了 H2 后发现的一些限制:Quercus 的 MySQL 驱动无法和 H2 的 MySQL 兼容模式良好的工作,我必须使用 Quercus 的 PDO 驱动来替代。

MySQL Embedded 则是 100% 兼容 MySQL,我还没有开始测试。但也有一些不确定的问题,我不清楚是否可以分发包含 MySQL Embedded 的应用程序,这可能需要购买商业授权。

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn