輕量級資料庫比較:SQLite、H2 和 MySQL Embedded

來源:互聯網
上載者:User

對 PHP程式員來說,SQLite可以快速的搭建資料庫開發環境,提供輕鬆、自容器、無配置、無獨立服務的資料庫環境,所有資料儲存在一個檔案裡。當使用 MySQL 作為最終生產平台時,SQLite 是不可替代的開發環境解決方案。但真的沒有其他相容性更好的選擇了嗎?好吧,僅舉幾個原因:MySQL的相容性和支援雜湊索引,還不止這些!

當我們尋找 SQLite 的替代方案時,有兩個可選,分別是 H2 和 MySQL Embeded 版本。我關注的是可像 SQLite 一樣方便使用,但又必須相容 MySQL。

下面我們對三個資料庫進行簡單的比較:

比較項目
SQLite H2 database engine MySQL Embedded
Footprint 350KiB ~1MB <2MB
授權協議
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 的應用程式,這可能需要購買商業授權。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.