[wp-hackers] Shared Knowledge for Developers

Matt Mullenweg m at mullenweg.com
Tue Sep 4 02:09:19 GMT 2007


Matt Mullenweg wrote:
> If you have a question you'd like to never answer again, reply to this 
> message with the question AND an answer, and I'll collate and edit them 
> all into a coherent developer intro FAQ.

Why does WordPress only support MySQL? What about DB abstraction?


While in theory supporting more databases is better than supporting one, 
in practice we've found focusing on MySQL has a number of benefits.

First, introducing support for databases other than MySQL would increase 
the testing load for all development quite a bit, as already the 
combinations of PHP versions, web servers like Apache, Lighttpd, and 
IIS, and Windows vs Linux cause a number of issues, multiplying that by 
an arbitrary number of database platforms is daunting.

Early on in WordPress' history when DB abstraction was seriously 
considered we noticed packages like AdoDB were bigger than WordPress 
itself, which seemed like a lot of weight for little gain.

DB independence also requires far more than just dropping in a DB 
abstraction class, as basic assumptions WP makes about things like 
primary keys, indicies, auto incrementing fields, LIMITs, and more vary 
more from DB to DB than a class could support without serious code changes.

Finally, MySQL is ubiquitous and has shown to be fast enough and 
scalable enough for the highest traffic loads, so supporting other DBs 
would not improve the WordPress experience or our popularity much. As a 
feature request it comes of fairly infrequently.

All that said, every query in WordPress goes through a class called wpdb 
and that class can be replaced with your own by putting a db.php file in 
wp-content. So far this has been used for mysqli support and an advanced 
enterprise DB class called HyperDB, but in theory you could use that, 
and some wicked regular expressions, to add support for a MySQL-like 
database without any core code modifications.

-- 
Matt Mullenweg
  http://photomatt.net | http://wordpress.org
http://automattic.com | http://akismet.com


More information about the wp-hackers mailing list