Advertisement
Guest User

Untitled

a guest
Sep 17th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 4.76 KB | None | 0 0
  1. mysql> EXPLAIN SELECT (SELECT COUNT(*) FROM `postman_message` T WHERE T.`thread_id` = `postman_message`.`thread_id` ) AS `count`, `postman_message`.`id`, `postman_message`.`subject`, `postman_message`.`body`, `postman_message`.`sender_id`, `postman_message`.`recipient_id`, `postman_message`.`email`, `postman_message`.`parent_id`, `postman_message`.`thread_id`, `postman_message`.`sent_at`, `postman_message`.`read_at`, `postman_message`.`replied_at`, `postman_message`.`sender_archived`, `postman_message`.`recipient_archived`, `postman_message`.`sender_deleted_at`, `postman_message`.`recipient_deleted_at`, `postman_message`.`moderation_status`, `postman_message`.`moderation_by_id`, `postman_message`.`moderation_date`, `postman_message`.`moderation_reason`, T3.`id`, T3.`username`, T3.`first_name`, T3.`last_name`, T3.`email`, T3.`password`, T3.`is_staff`, T3.`is_active`, T3.`is_superuser`, T3.`last_login`, T3.`date_joined`, `auth_user`.`id`, `auth_user`.`username`, `auth_user`.`first_name`, `auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`, `auth_user`.`is_active`, `auth_user`.`is_superuser`, `auth_user`.`last_login`, `auth_user`.`date_joined` FROM `postman_message` LEFT OUTER JOIN `auth_user` ON (`postman_message`.`recipient_id` = `auth_user`.`id`) LEFT OUTER JOIN `auth_user` T3 ON (`postman_message`.`sender_id` = T3.`id`) LEFT OUTER JOIN `postman_message` T4 ON (`postman_message`.`thread_id` = T4.`id`) WHERE (`postman_message`.`id` IN (SELECT MAX(U0.`id`) AS `pk__max` FROM `postman_message` U0 WHERE (U0.`thread_id` IS NOT NULL AND ((U0.`recipient_archived` = True AND U0.`moderation_status` = "a" AND U0.`recipient_id` = 14028 AND U0.`recipient_deleted_at` IS NULL) OR (U0.`sender_archived` = True AND U0.`sender_deleted_at` IS NULL AND U0.`sender_id` = 14028 ))) GROUP BY U0.`thread_id` ORDER BY NULL) OR (((`postman_message`.`recipient_archived` = True AND `postman_message`.`moderation_status` = "a" AND `postman_message`.`recipient_id` = 14028 AND `postman_message`.`recipient_deleted_at` IS NULL) OR (`postman_message`.`sender_archived` = True AND `postman_message`.`sender_deleted_at` IS NULL AND `postman_message`.`sender_id` = 14028 )) AND T4.`id` IS NULL)) ORDER BY `postman_message`.`sent_at` DESC, `postman_message`.`id` DESC LIMIT 1;
  2. +----+--------------------+-----------------+--------+----------------------------------------------------------------------------+--------------------------+---------+----------------------------------------------+------+-----------------------------+
  3. | id | select_type        | table           | type   | possible_keys                                                              | key                      | key_len | ref                                          | rows | Extra                       |
  4. +----+--------------------+-----------------+--------+----------------------------------------------------------------------------+--------------------------+---------+----------------------------------------------+------+-----------------------------+
  5. |  1 | PRIMARY            | postman_message | ALL    | postman_message_901f59e9,postman_message_fcd09624                          | NULL                     | NULL    | NULL                                         | 3387 | Using where; Using filesort |
  6. |  1 | PRIMARY            | auth_user       | eq_ref | PRIMARY                                                                    | PRIMARY                  | 4       | teleforma_crfpa.postman_message.recipient_id |    1 |                             |
  7. |  1 | PRIMARY            | T3              | eq_ref | PRIMARY                                                                    | PRIMARY                  | 4       | teleforma_crfpa.postman_message.sender_id    |    1 |                             |
  8. |  1 | PRIMARY            | T4              | eq_ref | PRIMARY                                                                    | PRIMARY                  | 4       | teleforma_crfpa.postman_message.thread_id    |    1 | Using where; Using index    |
  9. |  3 | DEPENDENT SUBQUERY | U0              | range  | postman_message_901f59e9,postman_message_fcd09624,postman_message_9a6ed576 | postman_message_9a6ed576 | 5       | NULL                                         | 3110 | Using where                 |
  10. |  2 | DEPENDENT SUBQUERY | T               | ref    | postman_message_9a6ed576                                                   | postman_message_9a6ed576 | 5       | teleforma_crfpa.postman_message.thread_id    |  395 | Using where; Using index    |
  11. +----+--------------------+-----------------+--------+----------------------------------------------------------------------------+--------------------------+---------+----------------------------------------------+------+-----------------------------+
  12. 6 rows in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement