Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. SELECT * FROM table1 WHERE (cols1=1000 OR cols2=1000) AND cols3=1;
  2.  
  3. +----+-------------+---------+------+-------------------------+------+---------+------+--------+-----------------------------+
  4. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  5. +----+-------------+---------+------+-------------------------+------+---------+------+--------+-----------------------------+
  6. | 1 | SIMPLE | matches | ALL | cols3,cols1,cols2 | NULL | NULL | NULL | 480000 | Using where; Using filesort |
  7. +----+-------------+---------+------+-------------------------+------+---------+------+--------+-----------------------------+
  8.  
  9. SELECT * FROM (SELECT cols1,cols2,cols3 FROM table1 WHERE ((cols1=1000)OR(cols2=2768))) AS t1 WHERE t1.cols1=1;
  10.  
  11. +----+-------------+------------+-------------+------------------+------------------+---------+------+------+---------------------------------------------------------+
  12. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  13. +----+-------------+------------+-------------+------------------+------------------+---------+------+------+---------------------------------------------------------+
  14. | 1 | PRIMARY | <derived2> | ALL | NULL | NULL | NULL | NULL | 173 | Using where; Using filesort |
  15. | 2 | DERIVED | matches | index_merge | cols1,cols2 | cols1,cols2 | 4,4 | NULL | 343 | Using union(cols1,cols2); Using where; Using index |
  16. +----+-------------+------------+-------------+------------------+------------------+---------+------+------+---------------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement