what to do when your WordPress database is too large?

Well I have asked this question in WP Forums, StackOverflow, and GoDaddy community as well, but nothing worked out. Hoping something is in here.

I used 2 separated subdomains for my blog and site (2separate SQL database). But not I cudn’t maintain separately so trying to merge them into a single WP driven site. If I do that, I will end up with limitation of max 1GB SQL DB set by GoDaddy (and I can’t purchase dedicated solutions for this).

Read More

There is a way out to split a single DB into 2, or use more than 1 DB for WP. So, asking for you genius guys to help me out.

Related posts

Leave a Reply

2 comments

  1. Not 100% sure how your DB could get that big. Have you gone through and cleaned out post revisions, old rows in the wp_options table from old plugins, etc?

  2. I have a working solution but it could seems a bit hackish.
    Put this code inside your wp-config.php and have fun!
    Note: You need to remove other occurences of define(‘DB_NAME’) etc.

    switch($_SERVER['HTTP_HOST'])
    {
     case 'blog.example.com': 
    {
        define('DB_NAME', 'database_1');
        define('DB_USER', 'user_for_db1');
        define('DB_PASSWORD', 'pwd_for_db1');
        define('DB_HOST', 'localhost');
        break;
    }
     case 'www.example.com': 
    {
        define('DB_NAME', 'database_2');
        define('DB_USER', 'user_for_db2');
        define('DB_PASSWORD', 'pwd_for_db2');
        define('DB_HOST', 'localhost');
        break;
    }
    

    The code above checks for $_SERVER[‘HTTP_HOST’] variable and switch db connection according to it.

    Hope this helps!