Forum Moderators: open

Message Too Old, No Replies

Mysql Query taking More than 6 seconds to execute

Query time problem

         

tabish

7:38 am on Jan 6, 2007 (gmt 0)

10+ Year Member



Hello,

I have one mysql Query:

select a.username,b.title,b.about_myself $sql_select from interests a INNER JOIN user_details b ON a.username=b.username where a.passion LIKE '%$passion%' or substring(soundex(a.passion),1,4)=substring(soundex('".$passion."'),1,4) and b.title <> '' and b.about_myself <> '' and b.block!='yes' order by b.user_index desc

I tried to optimize this .. but still this query is taking more than 6 seconds to execute..

Can anyone help me out here?

Thank you so much..

Regards

the_nerd

1:27 pm on Jan 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"soundex" and "like" don't exactly speed up your queries. I'd try and find ways aound these. Did you try a full text index?

tabish

1:33 pm on Jan 6, 2007 (gmt 0)

10+ Year Member



actually it is a search statement that is why i need to use soundex and like..

see if you can help me out to make it a bit FAST.. if the results are much then it is taking more than 25 seconds to execute the query.. which is much more.. and i know it will be considerred as a bad select statement..

Thank you for your reply..
regards

the_nerd

2:32 pm on Jan 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



how many rows do you have in both tables, what kind of index files did you specify?

(small change I can see: block = "yes". don't use string variables for this, but boolean or tinyint (0/1). I don't think this will help a lot if at all, but it's just useless weight.)