List:MySQL Documentation« Previous Message
From:Louis Hust Date:May 10 2014 4:35am
Subject:MySQL5.5 8.2.1.14 Optimizing Subqueries with EXISTS Strategy
View as plain text  
Hi, all

I read manual of MySQL 5.5,
and found the following section:

EXISTS (SELECT 1 FROM ... WHERE *subquery_where* AND
        (*outer_expr*=*inner_expr* OR *inner_expr* IS NULL))


And i think the convert is wrong.

create table t1(c1 int );

 create table t2(c2 int);

insert into t1 values(1);

insert into t2 values(null);

mysql> select * from t1 where c1 in (select c2 from t2);
Empty set (0.01 sec)

mysql> select * from t1 where exists (select c2 from t2 where c2 =c1 or c2
is null);
+------+
| c1   |
+------+
|    1 |
+------+
1 row in set (0.00 sec)

So the convert is not  equivalent*, Any idea?*

Thread
MySQL5.5 8.2.1.14 Optimizing Subqueries with EXISTS StrategyLouis Hust10 May 2014