Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick
brad

going well ....

LiveJournal optimizations are going well... MySQL likes my query:

mysql> explain SELECT
-> h.userid, h.itemid, h.security, u.user
-> FROM
-> hintfriendsview h,
-> user u,
-> log l
-> LEFT JOIN friends f ON u.user=f.user AND f.friend='bradfitz'
-> WHERE
-> h.itemid = l.itemid AND
-> h.userid = u.userid AND
-> h.userid = 1
-> AND ((l.security='public')
-> OR (l.security='usemask' AND l.allowmask & f.groupmask)
-> OR (u.user='bradfitz'))
-> ORDER BY h.logtime DESC;
+-------+--------+--------------------+---------+---------+-----------------+------+------------+
| table | type | possible_keys | key | key_len | ref | rows | Extra |
+-------+--------+--------------------+---------+---------+-----------------+------+------------+
| u | const | user,PRIMARY | PRIMARY | 4 | ??? | 1 | |
| f | const | user,user_2,friend | user | 30 | u.user,bradfitz | 1 | |
| h | ref | userid,itemid | userid | 4 | ??? | 7 | |
| l | eq_ref | PRIMARY | PRIMARY | 4 | h.itemid | 1 | where used |
+-------+--------+--------
Tags: mysql, tech
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments