Skip to content

Instantly share code, notes, and snippets.

@halfak
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halfak/38b1917d4a34d902d083 to your computer and use it in GitHub Desktop.
Save halfak/38b1917d4a34d902d083 to your computer and use it in GitHub Desktop.
mysql:research@analytics-store.eqiad.wmnet [enwiki]> explain SELECT
-> DATABASE() AS wiki,
-> user_id,
-> revision.rev_id,
-> page_namespace,
-> CAST(revision.rev_len AS INT) -
-> CAST(IFNULL(parent.rev_len, 0) AS INT) AS bytes_changed,
-> IFNULL(parent.rev_len, 0) AS previous_bytes
-> FROM staging.tr_experimental_user
-> INNER JOIN revision FORCE INDEX (user_timestamp) ON
-> user_id = rev_user AND
-> revision.rev_timestamp BETWEEN
-> user_registration AND
-> DATE_FORMAT(DATE_ADD(user_registration, INTERVAL 7 DAY), "%Y%m%d%H%i%S")
-> LEFT JOIN revision parent ON
-> parent.rev_id = revision.rev_parent_id
-> INNER JOIN page ON
-> revision.rev_page = page_id
-> WHERE wiki = DATABASE();
+------+-------------+----------------------+--------+----------------+---------+---------+--------------------------------+-----------+------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+----------------------+--------+----------------+---------+---------+--------------------------------+-----------+------------------------------------+
| 1 | SIMPLE | revision | ALL | user_timestamp | NULL | NULL | NULL | 578174608 | |
| 1 | SIMPLE | page | eq_ref | PRIMARY | PRIMARY | 4 | enwiki.revision.rev_page | 1 | |
| 1 | SIMPLE | tr_experimental_user | eq_ref | PRIMARY | PRIMARY | 56 | const,enwiki.revision.rev_user | 1 | Using index condition; Using where |
| 1 | SIMPLE | parent | eq_ref | rev_id | rev_id | 4 | enwiki.revision.rev_parent_id | 1 | Using where |
+------+-------------+----------------------+--------+----------------+---------+---------+--------------------------------+-----------+------------------------------------+
4 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment