Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - SQLite vs SQLite3

Tags:

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?

like image 945
ThunderLegs Avatar asked Dec 07 '10 05:12

ThunderLegs


People also ask

Is sqlite3 the same as SQLite?

The wiki tag description for both tags is the same: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The sqlite3 has no synonyms but sqlite has sqlitedatabase as a solitary synonym.

Does PHP support sqlite3?

PHP provides two SQLite extensions by default since version 5.0. The latest SQLite extension is known as sqlite3 extension that is included in PHP 5.3+. The sqlite3 extension provides an interface for accessing SQLite 3. The sqlite3 includes class interfaces to the SQL commands.

Is sqlite3 a good database?

SQLite works great as the database engine for most low to medium traffic websites (which is to say, most websites). The amount of web traffic that SQLite can handle depends on how heavily the website uses its database. Generally speaking, any site that gets fewer than 100K hits/day should work fine with SQLite.

Is SQLite a frontend or backend?

sql - Using SQLite database as backend, MS Access for Frontend, more than 2 gigs of data - Stack Overflow.


2 Answers

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

like image 111
Bogdev Avatar answered Sep 25 '22 23:09

Bogdev


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).

like image 37
Alex LE Avatar answered Sep 22 '22 23:09

Alex LE