Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. EXPLAIN SELECT * FROM staff WHERE department = "Cooking" AND address="Dallas";
  2.  
  3. +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
  4. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  5. +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
  6. | 1 | SIMPLE | staff | ALL | NULL | NULL | NULL | NULL | 7 | Using where |
  7. +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
  8.  
  9. CREATE INDEX address_idx ON staff(address);
  10. Query OK, 0 rows affected (0.06 sec)
  11. Records: 0 Duplicates: 0 Warnings: 0
  12.  
  13. EXPLAIN SELECT * FROM staff WHERE department = "Cooking" AND address="Dallas";
  14. +------+-------------+-------+------+---------------+-------------+---------+-------+------+------------------------------------+
  15. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  16. +------+-------------+-------+------+---------------+-------------+---------+-------+------+------------------------------------+
  17. | 1 | SIMPLE | staff | ref | address_idx | address_idx | 130 | const | 2 | Using index condition; Using where |
  18. +------+-------------+-------+------+---------------+-------------+---------+-------+------+------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement