PHP - SQLite 与 SQLite3
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4373562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP - SQLite vs SQLite3
提问by ThunderLegs
I've made a web application using SQLite (2.8.17), I've only now discovered that there's an SQLite3. It somehow eluded my attention when making the web application, probably due to the lack of documentation for the php functions.
我已经使用 SQLite (2.8.17) 制作了一个 Web 应用程序,我现在才发现有一个 SQLite3。在制作 Web 应用程序时,它以某种方式避开了我的注意力,可能是由于缺乏 php 函数的文档。
I'm wondering, what are the benefits of using SQLite3 over SQLite? Is it considerably faster?
我想知道,在 SQLite 上使用 SQLite3 有什么好处?是不是快了很多?
回答by Bogdev
SQLite2 internally stores every value as a string, regardless of its type.
Upgrading to SQLite3 will certainly shrink the database size since numbers and BLOBS get stored in their native formats, which could make things run faster.
Another big advantage in my opinion is that recent versions of sqlite, (starting from 3.6.23) support foreign keys.
SQLite2 在内部将每个值存储为字符串,而不管其类型如何。
升级到 SQLite3 肯定会缩小数据库大小,因为数字和 BLOBS 以它们的本机格式存储,这可以使事情运行得更快。
在我看来,另一个很大的优势是最近版本的 sqlite(从 3.6.23 开始)支持外键。
Since you were using PHP, I would suggest that you look into PDO. It could prove helpful in case you need to change the DBMS for the application
由于您使用的是 PHP,我建议您查看PDO。如果您需要更改应用程序的 DBMS,它可能会有所帮助
回答by Alex LE
This documents from the sqlite.org website: http://www.sqlite.org/version3.htmlit doesn't talk about performance, but differences. anyway there are not update to sqlite2 I personally recommend using latest and greatest version 3 (see Improved Concurrency, always good for web applications).
该文档来自 sqlite.org 网站:http://www.sqlite.org/version3.html它不讨论性能,而是讨论差异。无论如何,sqlite2 没有更新我个人建议使用最新和最好的版本 3(请参阅改进的并发性,始终适用于 Web 应用程序)。