Home > Articles > Programming > PHP

  • Print
  • + Share This
Like this article? We recommend

Alternatives to MySQL

MySQL is the database everyone loves to hate. It barely qualifies as a database in many respects, since it has few of the features of a modern database. The one redeeming feature of MySQL is its speed on simple selects. If most of your workload involves reading data from individual tables, then MySQL might not be a bad choice.

With more complex queries, the query optimizer in PostgreSQL often performs better than MySQL does. PostgreSQL also has more developer-friendly licensing. MySQL, including the client libraries, is licensed under the GPL. This means that any code which links against the MySQL client libraries must also be licensed under the GPL, or the developer must buy a license from MySQL AB to have these conditions waived. PostgreSQL is BSD licensed, and therefore carries none of these constraints.

PostgreSQL is a full-featured ACID-compliant database with good SQL standard compliance and mature support for features such as stored procedures, triggers, and fine-grained locking.

At the opposite end of the scale is SQLite, a Free Software project with the least restrictive license possible—namely, none at all. The code is in the public domain, and can be used by anyone for any purpose. This makes it popular in commercial projects—Apple uses it extensively in OS X 10.4, for example—and also means that it avoids the licensing issues associated with MySQL.

SQLite follows a much simpler design than most databases. It doesn’t provide a server process for concurrent clients. Each SQLite database is a file on disk, which can be opened, read from, and written to using an SQL interface. This setup makes it ideal for embedded applications, in which only a single application will be accessing the database.

Unlike most "real" databases, SQLite doesn’t fully support typed data; everything is stored as a string. This makes it a good choice for loosely typed languages such as PHP. If only a single application is accessing the database, SQLite can run significantly faster than MySQL or PostgreSQL.

In general, SQLite is a good solution to any problem where slightly more structure is needed than can easily be provided by flat text files.

Other databases, such as Firebird or Apache Derby, offer additional benefits and drawbacks, and may well be suitable for a particular scenario.

  • + Share This
  • 🔖 Save To Your Account