A small robot sits on a book while reading it.

The Databases of WordPress – SQLite

It has been years since I wrote an article in this series, but now is the time for another one.

Content

  • What is SQLite?
  • How SQLite Works
  • SQLite Resources

SQLite is an up and coming open-source database (at least in the WordPress universe). Previous articles looked at how MySQL and MariaDB work with WordPress. This one looks at the new kid on the block.


What is SQLite?

Like the other DBs, SQLite organizes, stores, and retrieves all the critical parts of your site like pages, posts, user profiles, and images in the database.


How Does SQLite Work?

"SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. SQLite is the most used database engine in the world. SQLite is built into all mobile phones and most computers and comes bundled inside countless other applications that people use every day."

WordPress integration of SQLite is currently via a plugin, SQLite Database Integration. They say:

"The SQLite plugin is a community, feature plugin. The intent is to allow testing an SQLite integration with WordPress and gather feedback, with the goal of eventually landing it in WordPress core. This feature plugin includes code from the PHPMyAdmin project (specifically parts of the PHPMyAdmin/sql-parser library), licensed under the GPL v2 or later."

In fact , there was just a new driver released for it. This makes it more compatible with existing sites.

So, as mentioned in the MySQL article, when a visitor goes to your site, the WordPress core queries the database. The database then returns the requested data. WordPress core combines the retrieved data and executes its PHP code to dynamically generate an HTML page. That page is served to your visitor's browser.

SQLite is fully capable of this functionality for smallish WordPress sites. However, SQLite does it in a different way.

Again according to WordPress.com::

"SQLite is not directly comparable to client/server SQL database engines such as MySQL, Oracle, PostgreSQL, or SQL Server since SQLite is trying to solve a different problem.

"Client/server SQL database engines strive to implement a shared repository of enterprise data. They emphasize scalability, concurrency, centralization, and control. SQLite strives to provide local data storage for individual applications and devices. SQLite emphasizes economy, efficiency, reliability, independence, and simplicity."

SQLite is perfect for demo sites. In fact, the WordPress Playground site uses it.

Wrapping Up

As you have seen, SQLite can indeed be used with WordPress:

  • It works well with small WordPress sites.
  • And it works very well with WordPress demo sites.

SQLite Resources