User:Werdna/Evil Query

From MediaWiki.org
Jump to navigation Jump to search
mysql> explain SELECT rc_timestamp,         rc_log_action,         rc_namespace,         rc_title,         user_name,         user_editcount,         rc_comment,
(unix_timestamp(rc_timestamp)-unix_timestamp(user_registration)) as user_age,         log_params,         ipb_expiry FROM recentchanges        LEFT OUTER JOIN logging ON
log_id=rc_logid        LEFT OUTER JOIN user ON user_id=rc_user         LEFT OUTER JOIN ipblocks ON ipb_address=rc_user_text AND
(unix_timestamp(ipb_timestamp)-unix_timestamp(rc_timestamp))<600 ORDER BY rc_timestamp DESC LIMIT 50000;
+----+-------------+---------------+--------+---------------+---------+---------+------+---------+---------------------------------+
| id | select_type | table         | type   | possible_keys | key     | key_len | ref  | rows    | Extra                           |
+----+-------------+---------------+--------+---------------+---------+---------+------+---------+---------------------------------+
|  1 | SIMPLE      | recentchanges | ALL    | NULL          | NULL    | NULL    | NULL | 6289048 | Using temporary; Using filesort |
|  1 | SIMPLE      | logging       | eq_ref | PRIMARY       | PRIMARY | 4       | func |       1 |                                 |
|  1 | SIMPLE      | user          | eq_ref | PRIMARY       | PRIMARY | 4       | func |       1 |                                 |
|  1 | SIMPLE      | ipblocks      | ALL    | NULL          | NULL    | NULL    | NULL |  281149 |                                 |
+----+-------------+---------------+--------+---------------+---------+---------+------+---------+---------------------------------+
4 rows in set (0.00 sec)