PDA

View Full Version : Slow Query Log Entry Diagnosis (Search)


kontrabass
Tue 19th Dec '06, 12:42pm
Hello,

I'm trying to figure out why some search queries are locking up my boards. I use fulltext, have boolean enabled for about 20% of my users, and Natural on for the rest. This query isn't a boolean search is it?


# Query_time: 107 Lock_time: 0 Rows_sent: 400 Rows_examined: 379932
SELECT
DISTINCT thread.threadid, thread.forumid, post.userid
FROM thread AS thread
INNER JOIN post AS post ON(thread.threadid = post.threadid )
WHERE MATCH(post.title, post.pagetext) AGAINST ('back in black') AND thread.forumid NOT IN (0,158,14,157,118,10,68,147,69,85,75,104,161,76,77 ,162,86,103,84,87,88,90,80) AND thread.forumid IN(66) AND post.visible = 1
LIMIT 400;
It seems like if it is a boolean search the words "IN BOOLEAN MODE" follow the search operators. So I'm wondering why a fulltext natural search is locking up the tables for 107 seconds. I've tried to duplicate it doing my own search with the same terms, but it only takes a few seconds.

I've optimized my DB server per Eva's suggestions, and for the most part it will just hum along, even during peak hours. So it's even more wierd when a 107 slow query like this locks things up during non-peak. Is there anything I can do to help this?

Thanks -

Paul