Skip to content

Instantly share code, notes, and snippets.

@archon810
Last active August 29, 2015 13:59
Show Gist options
  • Save archon810/0f6bb97e5a7e29e4d1e9 to your computer and use it in GitHub Desktop.
Save archon810/0f6bb97e5a7e29e4d1e9 to your computer and use it in GitHub Desktop.
mysql> explain SELECT pollip_aid FROM wp_pollsip WHERE pollip_qid = 158 AND pollip_ip = '157.56.92.155';
+----+-------------+------------+------+---------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+---------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | wp_pollsip | ALL | pollip_qid | NULL | NULL | NULL | 914036 | Using where |
+----+-------------+------------+------+---------------+------+---------+------+--------+-------------+
1 row in set
KEY `pollip_qid_2` (`pollip_qid`, `pollip_ip`)
mysql> explain SELECT SQL_NO_CACHE pollip_aid FROM wp_pollsip USE INDEX (pollip_qid_2) WHERE pollip_qid = 158 AND pollip_ip = '157.56.92.155';
+----+-------------+------------+------+---------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+---------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | wp_pollsip | ALL | pollip_qid_2 | NULL | NULL | NULL | 914053 | Using where |
+----+-------------+------------+------+---------------+------+---------+------+--------+-------------+
1 row in set
KEY `pollip_qid_2` (`pollip_ip`,`pollip_qid`)
mysql> explain SELECT SQL_NO_CACHE pollip_aid FROM wp_pollsip USE INDEX (pollip_qid_2) WHERE pollip_qid = 158 AND pollip_ip = '157.56.92.155';
+----+-------------+------------+------+---------------+--------------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+---------------+--------------+---------+-------+------+-------------+
| 1 | SIMPLE | wp_pollsip | ref | pollip_qid_2 | pollip_qid_2 | 102 | const | 1 | Using where |
+----+-------------+------------+------+---------------+--------------+---------+-------+------+-------------+
1 row in set
mysql> explain SELECT SQL_NO_CACHE pollip_aid FROM wp_pollsip WHERE pollip_qid = 158 AND pollip_ip = '157.56.92.155';
+----+-------------+------------+------+-------------------------+--------------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+-------------------------+--------------+---------+-------+------+-------------+
| 1 | SIMPLE | wp_pollsip | ref | pollip_qid,pollip_qid_2 | pollip_qid_2 | 102 | const | 1 | Using where |
+----+-------------+------------+------+-------------------------+--------------+---------+-------+------+-------------+
1 row in set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment