Host: localhost
Database: sts
Generation Time: Sep 23, 2012 at 12:51 AM
Generated by: phpMyAdmin 3.5.1 / MySQL 5.1.36-community-log
SQL query: EXPLAIN SELECT t.* , u.pushover_key AS
`owner_pushover_key`, u.name AS `owner_name`, u.id AS `owner_id`,
u.email AS `owner_email`, u.phone_number AS `owner_phone`,
u.email_notifications AS `owner_email_notifications`, u2.pushover_key AS
`assigned_pushover_key`, u2.name AS `assigned_name`, u2.id AS
`assigned_id`, u2.email AS `assigned_email`, u2.email_notifications AS
`assigned_email_notifications`, u3.name AS `submitted_name`, u3.id AS
`submitted_id`, u3.email AS `submitted_email`, u3.email_notifications AS
`submitted_email_notifications`, tp.name AS `priority_name`, td.name AS
`department_name`, ts.name AS `status_name`, ts.colour AS
`status_colour`, ts.active AS `active`, pa.name AS `pop_account_name`
FROM tickets t LEFT JOIN users u ON u.id = t.user_id LEFT JOIN users u2
ON u2.id = t.assigned_user_id LEFT JOIN users u3 ON u3.id =
t.submitted_user_id LEFT JOIN ticket_priorities tp ON tp.id =
t.priority_id LEFT JOIN ticket_departments td ON td.id = t.department_id
LEFT JOIN ticket_status ts ON ts.id = t.state_id LEFT JOIN pop_accounts
pa ON pa.id = t.pop_account_id WHERE 1 = 1 AND t.site_id = 1 AND (
t.department_id IN (SELECT utd.department_id FROM users_to_departments
utd WHERE utd.user_id = 5 AND utd.site_id = 1) OR (t.assigned_user_id = 5
OR t.user_id = 5)) ORDER BY t.last_modified DESC LIMIT 50 OFFSET 0 ;
Rows: 9
id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
---|---|---|---|---|---|---|---|---|---|
1 | PRIMARY | t | index | assigned_user_id,user_id,site_id | last_modified | 8 | NULL | 50 | Using where |
1 | PRIMARY | u | eq_ref | PRIMARY | PRIMARY | 4 | sts.t.user_id | 1 | |
1 | PRIMARY | u2 | eq_ref | PRIMARY | PRIMARY | 4 | sts.t.assigned_user_id | 1 | |
1 | PRIMARY | u3 | eq_ref | PRIMARY | PRIMARY | 4 | sts.t.submitted_user_id | 1 | |
1 | PRIMARY | tp | eq_ref | PRIMARY | PRIMARY | 4 | sts.t.priority_id | 1 | |
1 | PRIMARY | td | eq_ref | PRIMARY | PRIMARY | 4 | sts.t.department_id | 1 | |
1 | PRIMARY | ts | eq_ref | PRIMARY | PRIMARY | 4 | sts.t.state_id | 1 | |
1 | PRIMARY | pa | eq_ref | PRIMARY | PRIMARY | 4 | sts.t.pop_account_id | 1 | |
2 | DEPENDENT SUBQUERY | utd | ref | site_id,user_id,department_id | user_id | 4 | const | 1 | Using where |