Is MySQL bad for (open source) software quality?

I think so.

Why? Because it’s basically a toy DBMS with too many non-standard behaviours.

A lot of open source projects choose MySQL mainly because it’s widely available among hosting providers, while better RDBMS like PostgreSQL1 are hard to find. The real problem is, a lot of open source developer know very little about SQL and databases: they make things up as they proceed in their project, almost often caring only that “it works” for them2. The result is that they learn wrong habits and write poor DB-related code, a trait common to many projects, sadly.

For instance, the inspiration for this rant comes from this bug report for Flyspray, a bug reporting system written in PHP. The report is about a pretty lame error in the SQL query used to fetch the task list, as detailed in the 9th comment. PostgreSQL is not “incredibly annoying regarding GROUP BY” as the Flyspray maintainer believes: PostgreSQL simply does the right thing to do in that case, just like every other serious3 RDBMS on the market. I was recently hired to port Flyspray to Oracle: needless to say that I had to fix this problem as well as several other queries.

Other examples of DB abuse include Mantis, another PHP bugtracker. If you had a chance to use it, probably you’ve seen the statistics at the bottom of the page, something like:

43 total queries executed.
30 unique queries executed.

I beg your pardon? 43 queries to display a 10 rows table? and why 13 of them have been performed twice? 🙂

So, please… kids don’t use MySQL at home. 🙂

I’m not saying that you should never use MySQL (there would be plenty of reasons to avoid it anyway ;-)) or that projects based on it suck (I like mantis, for one). It’s simply a bad choice for a beginner wishing to learn how to do things properly, IMHO.


1 my favorite open source RDBMS. If it seems like I’m doing some advocacy, well… maybe I am 🙂
2 I’ve got nothing against this attitude when it comes to free software: if you want things to get done as you wish, you should be prepared to do them yourself or pay for them, instead of expecting other people to do the dirty work for free 😉
3 yes, that excludes MySQL 😛

One comment

  1. bostjan says:

    I couldn’t agree more.. for a while i was confused by the fact, that mysql actually dominates the www world. And i was even more frustrated when i figured it out that you really can’t force referential integrity over myisam powered tables. In combination with PHP driven development ( let’s call it agile to be fancy ) i wouldn’t try to imagine the actual state of data integrity after 3 or 5 years of production time. Now build a serious app over that db ( let’s asume that the core business grows and outgrows the capabilities of web apps ).. software development should be taken more seriously.. seriously 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *