SharDB for WP 3.1

SharDB for WP 3.1

Early in the development of WordPress 3.0, we had a preliminary discussion on changing the WordPress database class (wpdb) so that it could be inherited by plugins implementing a custom database class. We had a longer discussion on the subject while together at WordCamp San Francisco. As a result, there was a small change to WordPress 3.0 which allows the wpdb class to be inherited.

In WordPress 3.1, inheriting wpdb will be the expected (but not required) behavior. The changeset for that was committed to WordPress trunk this week (trac discussion).

I've been working on switching SharDB over to inherit wpdb and finished up on a Development Version last night. I'm working with WordPress 3.0.1, but the dev version should work with WP 3.0 through to WP trunk. By taking advantage of inheritance, I was able to eliminate over 50% of the code in the SharDB custom DB class. All of the red in the Changeset is removed code.

(Visited 1 times, 1 visits today)
  • Ovidiu
    Posted at 09:06h, 08 October Reply

    cool. subscribed to the thread for further news on this.

  • Bethany
    Posted at 11:53h, 13 October Reply

    Hi Ron,
    I’m experimenting with setting up SharDB on my site, and I found a bug with the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE treatment in db.php.

    I posted a question, and subsequent fix for it over here, in case anyone else is needing help with that as well, but wanted to make sure I let you know about the info too.

    Thanks for the great work!

    • Ron
      Posted at 17:23h, 13 October Reply

      Thanks, I updated the development version linked in the post 🙂

  • Mark Ratledge
    Posted at 14:14h, 20 December Reply


    Woud like to try this on a WP3.1 mutlisite with 250 blogs. I’ve duped the one main database, but does this modify the original database? Can it be uninstalled if I need to move the sites and original database another server?

    Thanks, Mark

    • Ron
      Posted at 22:04h, 20 December Reply

      If you have a WP 3.1 network then download the development version. It has a tool for migrating the blog tables to the appropriate shards.

      SharDB does not modify the original DB. Assuming you’re not concerned about loss of data from implementation to move, there’s no harm in removing it. You can also backup the shards and restore them to a single DB on a different server.

  • Raymond
    Posted at 00:21h, 25 February Reply

    Hello, Ron

    Is there any news on SharDB for Wp 3.1 ? The previous version 2.7.4 ( ? ) wouldn’t work when I upgraded to 3.1 so I had to copy all blogs back to the home database to straighten things out. Still have a bit of a mess and another WP installation with SharDB to go.

    Was there something I may have missed when upgrading WP ?

    SharDB is a great plugin. Thanks.


    • Ron
      Posted at 09:27h, 25 February Reply

      Did you try the development version that I said I was working on above?

      • Raymond
        Posted at 07:07h, 28 February Reply

        Works GREAT !! Thanks.

        Thought I was using the plugin above but come to find out, I never replaced it… Oops…

  • Greg Fielding
    Posted at 19:38h, 05 April Reply

    Ron and Andrea,

    Any issues using WP-DB Manager plugin with shardb? I want to optimize my database without screwing it up 🙂


    • Ron
      Posted at 19:44h, 05 April Reply

      Hi Greg,

      I’m not sure. I don’t know of anyone using SharDB and WP-DB. I do all of my DB admin through SSH so I’m not that familiar with any of the DB admin plugins.

Post A Comment