Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT * FROM table1 WHERE (cols1=1000 OR cols2=1000) AND cols3=1;
- +----+-------------+---------+------+-------------------------+------+---------+------+--------+-----------------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+---------+------+-------------------------+------+---------+------+--------+-----------------------------+
- | 1 | SIMPLE | matches | ALL | cols3,cols1,cols2 | NULL | NULL | NULL | 480000 | Using where; Using filesort |
- +----+-------------+---------+------+-------------------------+------+---------+------+--------+-----------------------------+
- SELECT * FROM (SELECT cols1,cols2,cols3 FROM table1 WHERE ((cols1=1000)OR(cols2=2768))) AS t1 WHERE t1.cols1=1;
- +----+-------------+------------+-------------+------------------+------------------+---------+------+------+---------------------------------------------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+------------+-------------+------------------+------------------+---------+------+------+---------------------------------------------------------+
- | 1 | PRIMARY | <derived2> | ALL | NULL | NULL | NULL | NULL | 173 | Using where; Using filesort |
- | 2 | DERIVED | matches | index_merge | cols1,cols2 | cols1,cols2 | 4,4 | NULL | 343 | Using union(cols1,cols2); Using where; Using index |
- +----+-------------+------------+-------------+------------------+------------------+---------+------+------+---------------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement