PDA

View Full Version : WordPress Mod: avoid "too many queries" error


mitchind
6-19-05, 11:15 PM
fluke:
Used your docs to install my own package - worked great! Thanks again.

Don't know if you want to add this to your documentation or not, but this is a common PHP mod to other CMS packages here at Powweb. By using your limit of three database users, you can increase the total number of queries per hour to around 216,000 - instead of the 72,000 with the standard Wordpress install here.

If your blog is going to be a busy one, make this simple change to your wp-config.php
It'll help you avoid that "Too many queries" error.

Add your MySQL user/pwds in: Member Ops | Website | MySql
// ************** MULTIPLE USER MOD **************
// Insert after this line:
// define('DB_NAME', 'My_Database_Name_In_MySQL'); // The name of the database
// ***

$user = array();
$user[0] = 'wp_user_1'; // MySQL Database Users
$user[1] = 'wp_user_2';
$user[2] = 'wp_user_3';

$pwd = array();
$pwd[0] = 'user_1_password'; // Passwords for each user
$pwd[1] = 'user_2_password';
$pwd[2] = 'user_3_password;

// get index to random user
$which_user = rand(0,2);
$username = $user[$which_user];
$password = $pwd[$which_user];

define('DB_USER', $username); // Your MySQL username
define('DB_PASSWORD', $password); // ...and password

// ************** END OF MOD **************

fluKe
6-20-05, 04:48 PM
Thanks mitchind :)

I am currently working on finishing off a site which I will be hosting some more FAQs etc on which should (if I pull my finger out) be up next week after I get my graduation out of the way - I will add this into a seperate FAQ on that site and link to it from the main install guide as something which is advisable to do :)