简体   繁体   English

PHP - SQLite与SQLite3

[英]PHP - SQLite vs SQLite3

I've made a web application using SQLite (2.8.17), I've only now discovered that there's an SQLite3. 我使用SQLite(2.8.17)创建了一个Web应用程序,我现在才发现有一个SQLite3。 It somehow eluded my attention when making the web application, probably due to the lack of documentation for the php functions. 在制作Web应用程序时,它在某种程度上避开了我的注意力,可能是由于缺少php函数的文档。

I'm wondering, what are the benefits of using SQLite3 over SQLite? 我想知道,使用SQLite3而不是SQLite有什么好处? Is it considerably faster? 它快得多吗?

SQLite2 internally stores every value as a string, regardless of its type. SQLite2在内部将每个值都存储为字符串,而不管其类型如何。
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. 升级到SQLite3肯定会缩小数据库大小,因为数字和BLOBS以其原生格式存储,这可以使事情运行得更快。
Another big advantage in my opinion is that recent versions of sqlite, (starting from 3.6.23) support foreign keys. 我认为另一个很大的优点是最新版本的sqlite(从3.6.23开始)支持外键。

Since you were using PHP, I would suggest that you look into PDO . 既然您使用的是PHP,我建议您查看PDO It could prove helpful in case you need to change the DBMS for the application 如果您需要更改应用程序的DBMS,它可能会很有用

This documents from the sqlite.org website: http://www.sqlite.org/version3.html it doesn't talk about performance, but differences. 这个文件来自sqlite.org网站: http ://www.sqlite.org/version3.html它不谈性能,而是差异。 anyway there are not update to sqlite2 I personally recommend using latest and greatest version 3 (see Improved Concurrency, always good for web applications). 无论如何没有更新到sqlite2我个人建议使用最新和最好的版本3(参见改进的并发,总是适用于Web应用程序)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM