It looks like you're new here. If you want to get involved, click one of these buttons!
It seems to block all other processes. In mysql all other queries 'waiting for the table level lock'. Sometimes the query runs even longer as shown in the post above, sometimes until my server runs out of memory!# Time: 161120 19:58:17
# User@Host: custcare[custcare] @ localhost 
# Query_time: 844.755410 Lock_time: 0.000116 Rows_sent: 3 Rows_examined: 227210
SELECT A2.`id` AS `dept__id`, AVG(DATEDIFF(A1.`closed`, A1.`created`)) AS `ServiceTime`, AVG(DATEDIFF(A4.`created`, A5.`created`)) AS `ResponseTime` FROM `ost_ticket` A1 JOIN `ost_department` A2 ON (A1.`dept_id` = A2.`id`) LEFT JOIN `ost_thread` A3 ON (A3.`object_type` = 'T' AND A1.`ticket_id` = A3.`object_id`) LEFT JOIN `ost_thread_entry` A4 ON (A3.`id` = A4.`thread_id` AND A4.`type` = 'R') LEFT JOIN `ost_thread_entry` A5 ON (A4.`pid` = A5.`id`) WHERE A1.`dept_id` IN ('1', '4', '5') GROUP BY A2.`id`;