[wp-hackers] Shared Knowledge for Developers
Jacob Santos
dragonwing at dragonu.net
Tue Sep 4 02:42:19 GMT 2007
Matt Mullenweg wrote:
> 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.
Addendum:
There is a difference between Database Access Abstraction, which
WordPress already supports, and Database Abstraction, which is a
misnomer. Database Abstraction is difficult unless you use the most
basic of SQL, and even then you are not guaranteed full support. Each
database has features and optimizations that should be applied to each
database.
As for Database Abstraction, more advanced coders would suggest what
WordPress already does. By creating an API to wrap SQL, it allows for
the SQL and Database Access Layer can be changed to fully support the
new database. Doing so will most likely keep the same functionality
working, which is what Database Abstraction tries to solve.
Jacob Santos
PS, this is for clarity.
More information about the wp-hackers
mailing list