[rt-users] Bad query?

Jon Hittner jhittner at vmsinfo.com
Thu Sep 19 17:41:51 EDT 2002


Hi,
   Im running rt 2.0.9.   About once every 2 weeks the system seems to lock up.   When I do a show full processlist I see the query that is causing the problem:

SELECT DISTINCT main.* FROM Tickets main, Watchers Watchers_1, Watchers Watchers_3, Watchers Watchers_5  LEFT JOIN Users as Users_6  ON  Watchers_5.Owner = Users_6.id LEFT JOIN Users as User
s_2  ON  Watchers_1.Owner = Users_2.id LEFT JOIN Users as Users_4  ON  Watchers_3.Owner = Users_4.id  WHERE ((Watchers_3.Scope = 'Ticket')) AND ((Watchers_3.Type = 'Requestor')) AND ((Watchers_1.Sc
ope = 'Ticket')) AND ((Watchers_1.Type = 'Requestor')) AND ((Watchers_5.Type = 'Requestor')) AND ((Watchers_1.Email LIKE '%bdole%')OR(Users_2.EmailAddress LIKE '%bdole%')OR(Watchers_3.Email LIKE '%
bdole at vmsinfo.com%')OR(Users_4.EmailAddress LIKE '%bdole at vmsinfo.com%')OR(Watchers_5.Email LIKE '%bdole at vmsinfo.com%')OR(Users_6.EmailAddress LIKE '%bdole at vmsinfo.com%')) AND ((Watchers_5.Scope = '
Ticket'))  AND main.id = Watchers_1.Value  AND main.id = Watchers_3.Value  AND main.id = Watchers_5.Value ORDER BY main.id ASC LIMIT 49, 50;

when I describe the query I see:
+------------+--------+------------------+-----------+---------+------------------+-------+---------------------------------------------+
| table      | type   | possible_keys    | key       | key_len | ref              | rows  | Extra                                       |
+------------+--------+------------------+-----------+---------+------------------+-------+---------------------------------------------+
| Watchers_1 | range  | Watchers1        | Watchers1 |      17 | NULL             | 10219 | where used; Using temporary; Using filesort |
| main       | eq_ref | PRIMARY,Tickets4 | PRIMARY   |       4 | Watchers_1.Value |     1 |                                             |
| Watchers_3 | ALL    | Watchers1        | NULL      |    NULL | NULL             | 10219 | where used; Distinct                        |
| Watchers_5 | ALL    | Watchers1        | NULL      |    NULL | NULL             | 10219 | where used; Distinct                        |
| Users_6    | eq_ref | PRIMARY          | PRIMARY   |       4 | Watchers_5.Owner |     1 | Distinct                                    |
| Users_2    | eq_ref | PRIMARY          | PRIMARY   |       4 | Watchers_1.Owner |     1 | Distinct                                    |
| Users_4    | eq_ref | PRIMARY          | PRIMARY   |       4 | Watchers_3.Owner |     1 | where used; Distinct                        |
+------------+--------+------------------+-----------+---------+------------------+-------+---------------------------------------------+


Can anyone tell me what this is and why it hangs for what seems like forever?

Thanks,
Jon




More information about the rt-users mailing list