December 10th, 2008

Neko (lofulah)

phpBB phpbb_search_wordmatch/phpbb_search_wordlist slow queries

If your phpBB2 forum is running really slow, and mysql's "show processlist;" shows a lot of queries that look like:
SELECT m.word_id
  FROM phpbb_search_wordmatch m, phpbb_search_wordlist w
  WHERE w.word_text..

That may be the remove_common function in includes/functions_search.php, which, as far as I can tell, removes common keywords. Or something like that.

Credit for finding this goes to

I decided it's probably there for some sort of good reason, so I instead of just putting a "return;" at the top of that function, I did a "if (rand(0,1000) != 0) {return;}", which essentially means that once out of every 1000 times that function is called, it'll run through the function and do whatever it does.

This cut my server load average from 25 down to 0.5.