PHP - SQLite 与 SQLite3
我已经使用 SQLite (2.8.17) 制作了一个 Web 应用程序,我现在才发现有一个 SQLite3。在制作 Web 应用程序时,它以某种方式逃避了我的注意,可能是由于缺少 php 函数的文档。
我想知道,使用 SQLite3 比 SQLite 有什么好处?是不是快很多了?
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.
I'm wondering, what are the benefits of using SQLite3 over SQLite? Is it considerably faster?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SQLite2 在内部将每个值存储为字符串,无论其类型如何。
升级到 SQLite3 肯定会缩小数据库大小,因为数字和 BLOBS 以其本机格式存储,这可以使运行速度更快。
我认为另一个很大的优点是最近版本的 sqlite(从 3.6.23 开始)支持外键。
由于您使用的是 PHP,我建议您查看 PDO。如果您需要更改应用程序的 DBMS,它可能会很有帮助
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.
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
此文档来自 sqlite.org 网站:http://www.sqlite.org/version3.html 它不讨论性能,而是讨论差异。无论如何,sqlite2 没有更新,我个人建议使用最新和最好的版本 3(请参阅改进的并发性,对于 Web 应用程序总是有好处)。
This documents from the sqlite.org website: http://www.sqlite.org/version3.html it 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).