EXPLAIN says DEPENDENT SUBQUERY despite no free variables

2010-02-24 Thread Yang Zhang
I have the following query. Note that the nested query has no dependencies on the outer one, yet mysql reports it as dependent. Furthermore, it says the join type is an ALL (nested loop join, the slowest possible one, in which each row of the outer table results in a complete inner table scan),

Re: EXPLAIN says DEPENDENT SUBQUERY despite no free variables

2010-02-24 Thread Perrin Harkins
On Wed, Feb 24, 2010 at 10:11 AM, Yang Zhang yanghates...@gmail.com wrote: Any ideas on how to optimize this by convincing mysql to see the independence use a const join? http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/ You need to rewrite as a join or use a

RE: Index analyser

2010-02-24 Thread Andrew Braithwaite
There's also the Query Analyser http://www.mysql.com/products/enterprise/query.html which is part of MySQL Enterprise - I've never used it and it is very expensive but I believe it will advise on optimal indicies. Cheers, Andrew -Original Message- From: Cantwell, Bryan

RE: Index analyser

2010-02-24 Thread Andrew Braithwaite
You can use this to get rid of unused indicies too. http://www.mysqlperformanceblog.com/2009/01/15/dropping-unused-indexes/ Requires the percona extensions to be loaded. Cheers, Andrew -Original Message- From: Andrew Braithwaite [mailto:andrew.braithwa...@lovefilm.com] Sent: 24

Re: EXPLAIN says DEPENDENT SUBQUERY despite no free variables

2010-02-24 Thread Dan Nelson
In the last episode (Feb 24), Perrin Harkins said: On Wed, Feb 24, 2010 at 10:11 AM, Yang Zhang yanghates...@gmail.com wrote: Any ideas on how to optimize this by convincing mysql to see the independence use a const join?