On 11/12/06, Asif Iqbal <<a href="mailto:vadud3@gmail.com">vadud3@gmail.com</a>> wrote:<br>> Here is another slow query<br>> <br>> Reading mysql slow query log from webrt-mysql-slow.log<br>> Count: 66  Time=
158.26s (10445s)  Lock=0.00s (0s)  Rows=1.0 (66),<br>> rt_user[rt_user]@localhost<br>>   SELECT GET_LOCK('S', N)<br>> <br>> Anyway to improve this?<br><br>Here are some more extreme slow queries<br><br>Reading mysql slow query log from /export/home/ibdata/webrt-
mysql-slow.log<br>Count: 83  Time=135.24s (11225s)  Lock=0.00s (0s)  Rows=1.0 (83), rt_user[rt_user]@localhost<br>  SELECT GET_LOCK('S', N)<br><br>Count: 1  Time=75.00s (75s)  Lock=0.00s (0s)  Rows=1.0 (1), rt_user[rt_user]@localhost
<br>  SELECT COUNT(DISTINCT <a href="http://main.id">main.id</a>) FROM Tickets main , Transactions Transactions_1, Attachments Attachments_2  WHERE ((Transactions_1.ObjectType = 'S')) AND ((main.EffectiveId = <a href="http://main.id">
main.id</a>)) AND ((main.Status != 'S')) AND ((main.Type = 'S')) AND ((main.Status = 'S')AND(main.Queue = 'S')AND ( (Attachments_2.Content LIKE 'S')AND(Attachments_2.TransactionId = Transactions_1.id)AND(<a href="http://main.id">
main.id</a> = Transactions_1.ObjectId) ) )<br><br>Explain of the second select query gives impossible where as following<br><br>mysql> explain SELECT COUNT(DISTINCT <a href="http://main.id">main.id</a>) FROM Tickets main , Transactions Transactions_1, Attachments Attachments_2 WHERE ((Transactions_1.ObjectType = 'S')) AND ((
main.EffectiveId = <a href="http://main.id">main.id</a>)) AND ((main.Status != 'S')) AND ((main.Type = 'S')) AND ((main.Status = 'S')AND(main.Queue = 'S')AND ( (Attachments_2.Content LIKE 'S') AND(Attachments_2.TransactionId = Transactions_1.id)AND(
<a href="http://main.id">main.id</a> = Transactions_1.ObjectId) ) );<br><br>+-----------------------------+<br>| Comment                |<br>+-----------------------------+<br>| Impossible WHERE |<br>+-----------------------------+
<br>1 row in set (0.00 sec)<br><br>Using mysql 4.0.24 and RT 3.4.5 <br><br>Any suggestion on how to improve that<br><br>> <br>> --<br>> Asif Iqbal<br>> PGP Key: 0xE62693C5 KeyServer: <a href="http://pgp.mit.edu">
pgp.mit.edu</a><br>> <br><br><br>-- <br>Asif Iqbal<br>PGP Key: 0xE62693C5 KeyServer: <a href="http://pgp.mit.edu">pgp.mit.edu</a><br><br><br><br>