mysql> explain select servername,serverarea,faction, charactername from all_customers where (servername,serverarea,faction,charactername) in (select servername,serverarea,faction,charactername from active_customers);
+----+--------------------+------------------+----------------+----------------+----------------+---------+---------------------+--------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------------+------------------+----------------+----------------+----------------+---------+---------------------+--------+--------------------------+
| 1 | PRIMARY | all_customers | index | NULL | index_all | 87 | NULL | 413891 | Using where; Using index |
| 2 | DEPENDENT SUBQUERY | active_customers | index_subquery | idx_server_all | idx_server_all | 87 | func,func,func,func | 1 | Using index; Using where |
+----+--------------------+------------------+----------------+----------------+----------------+---------+---------------------+--------+--------------------------+
2 rows in set (0.00 sec)
mysql> explain select servername,serverarea,faction, charactername from all_customers where (servername,serverarea,faction,charactername) not in (select servername,serverarea,faction,charactername from active_customers);
+----+--------------------+------------------+-------+----------------+----------------+---------+------+--------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------------+------------------+-------+----------------+----------------+---------+------+--------+--------------------------+
| 1 | PRIMARY | all_customers | index | NULL | index_all | 87 | NULL | 413891 | Using where; Using index |
| 2 | DEPENDENT SUBQUERY | active_customers | ref | idx_server_all | idx_server_all | 40 | func | 542 | Using where; Using index |
+----+--------------------+------------------+-------+----------------+----------------+---------+------+--------+--------------------------+
2 rows in set (0.00 sec)
阅读(646) | 评论(0) | 转发(0) |