[wp-hackers] MUlti-DB setup - An alternative approach that i
technocraze at gmail.com
Tue Mar 31 08:54:32 GMT 2009
Recently, while upgradation of our wordpress code base, from nightly
build (released in 2006) and i tried a different approach to implement
multi-db setup. We had around 10,000 blogs in the old setup, with more
than 1 lakh tables
In the current setup, the table variables in $wpdb is initialised to
tables along with prefix. I hacked that part of code, and in turn
initialised these variables, along with DB name. By this in all
queries, the DB name will also be included along with the table name.
I used the migration script of mutli-db plugin to split the tables in to
different databases (16 nos).
After implementing these changes all blogs were accessible fine, and we
sent this code base to our testing team, and no major issues were
reported. We made sure, that all SQL queries uses $wpdb variables for
the table names. Now the code is in production and running smooth. The
1 lakh tables is now split to around 5000 - 6000 tables to 17 different
Wanted to know your views on it.
More information about the wp-hackers