开发者

MySQL thinks subquery is derived when it is not!

EXPLAIN SELECT node_id 
          FROM node 
         WHERE person_id IN (SELECT person_id 
                               FROM user 
    开发者_开发知识库                          WHERE is_locked = 0);

Results in MySql telling me the subquery is derived. But it's not!

(I know this could easily be re-written as a JOIN, but I want to know why MySQL thinks this is a dependent subquery.)


This is a bug in the MySQL Query Optimizer. It would seem that, if the table in the subquery matches the table in the main query, it is considered a dependent subquery even if it obviously should not be, and there's no easy fix. Sorry; go for the join.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜