Notes to Myself

Why Use SQLite

Posted by Richard Cockrum on February 12, 2008

SQLite is a great little database engine. It is used in Firefox, Skype, the iPhone, and Symbian smartphones. PHP has built in access to SQLite. It may be the most widely deployed database engine in the world.

But why? There are many reasons. The major ones are

  • It is a true SQL database engine. It supports the majority of the SQL 92 standard. All transactions are ACID.
  • It is small. A typical installation occupies only about 256K on your drive.
  • It is self-contained. You don't need a server. One dynamic link library contains the complete engine. You can even statically link it to your software, so you don't have to rely on a dynamic link library.
  • There is no installation involved. You just use it.
  • SQLite doesn't spread files across your drive. The entire database is itself stored in one file.

Okay, so there are of good reasons to use SQLite, but where are good places to use it?

  • In desktop applications. SQLite makes a great application file format. You can use SQL, don't have to design your own file format, and don't have to fight with XML. It's one of the easiest ways to save data that I've seen. This is how I've used it most frequently in the applications I've written.
  • For smaller websites. SQLite should be able to manage a site that gets under 100,000 hits a day easily. In other words, most websites would be fine with SQLite as the database. This is one thing that has always irked me about WordPress. It is designed to work with MySQL, period. Most bloggers don't need the power that MySQL gives you. If your site does get busy enough to need MySQL, exporting the data from SQLite and importing it into MySQL isn't difficult. Its targetting of SQLite is one of the things that attracts me to Habari.
  • For embedded devices. The uses in the iPhone and Symbian I listed above are good examples of this. Compiled properly, SQLite can be even smaller than the 250K I talked about. With its lack of a need for management, it is a near perfect database for embedded use.

You can learn more about SQLite and download your own copy at the SQLite homepage.

1 Pingback to Why Use SQLite

0 Responses to Why Use SQLite

What do you think?

Subscribe

More Posts

Recent Comments

Tags