Chinaunix首页 | 论坛 | 博客
  • 博客访问: 249430
  • 博文数量: 61
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 800
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-14 15:18
文章分类

全部博文(61)

文章存档

2011年(4)

2010年(5)

2009年(10)

2008年(42)

我的朋友

分类: Mysql/postgreSQL

2008-03-12 10:55:38

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)
阅读(630) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~