Thread: Slow Queries
View Single Post

   
  #8 (permalink)  
Old 04-29-2008, 08:26 PM
Sebastian Mendel
 
Posts: n/a
Default Re: Slow Queries

D Hill schrieb:
> On Thu, 24 Apr 2008 at 08:58 +0200, lists@sebastianmendel.de confabulated:
>
>> D Hill schrieb:
>>>
>>> I have something I am trying to resolve with an over abundant number
>>> of slow queries. Perhaps it is because of some additional indexes
>>> needed. As soon as I enabled the option
>>> 'log_queries_not_using_indexes = 1' in the configuration file, I
>>> started getting messages relating to the select query:
>>>
>>> SELECT wite_what, wite_desc FROM witelist
>>> WHERE
>>> wite_what = '$oct1' OR
>>> wite_what = '$oct1.$oct2' OR
>>> wite_what = '$oct1.$oct2.$oct3' OR
>>> wite_what = '$oct1.$oct2.$oct3.$oct4' OR
>>> wite_what = '$from_name\@$from_dom' OR
>>> wite_what = '$rcpt_name\@$rcpt_dom' OR
>>> wite_what = '$from_dom' OR
>>> wite_what = '$rcpt_dom';

>>
>> did you tried (result depending on your MySQL version):
>>
>> WHERE wite_what IN ('$oct1', '$oct1.$oct2', '$oct1.$oct2.$oct3',
>> '$oct1.$oct2.$oct3.$oct4', '$from_name\@$from_dom',
>> '$rcpt_name\@$rcpt_dom', '$from_dom', '$rcpt_dom');

>
> MySQL version is 5.0.51. Sorry I forgot to mention that. I did change
> the query to what you have shown. I'll have to wait till the server
> comes under a load to tell. I have noted when the last slow query was
> logged for this and will see.
>
>> you could also vary with thee index length if wite_what.

>
> Right now the index is for the full length of the field (128). I just
> ran a query for the length of wite_what and the maximum length so far is
> 34. So, I will cut the index length down to 64.
>
>> and what indexes do you have currently exactly?

>
> id - is the primary and has an index type btree
> wite_what - is a unique and has an index type of btree


so this looks all ok, i am not sure if the query time includes the time if
the query needs to wait for locked tables ...

--
Sebastian
Reply With Quote