MySQL Forums
Forum List  »  Performance

Re: Dead query
Posted by: Rick James
Date: December 22, 2012 03:27PM

SHOW CREATE TABLE -- need to see the indexes.

Do you have indexes (or PRIMARY KEY) for everything in the WHERE clauses?

EXPLAIN SELECT ...

Does SHOW PROCESSLIST show it still running?

It _might_ help to do this before the query:
SET optimizer_search_depth = 7;

This _might_ help:

UO1.unidad AS nivel_1 ,
LEFT JOIN UNIDAD_ORGANIZATIVA UO1 ON (UO1.tk = SUBSTR(org.unidad, 1, 7))
-->
( SELECT unidad FROM UNIDAD_ORGANIZATIVA WHERE tk = SUBSTR(org.unidad, 1, 7)) ) AS nivel_1

That is, replace the LEFT JOIN with a subquery in the SELECT clause. This should have the identical semantics -- NULL if no such row exists.

(Repeat for the similar uses.)

Options: ReplyQuote


Subject
Views
Written By
Posted
3252
December 21, 2012 08:00AM
Re: Dead query
1094
December 22, 2012 03:27PM
1258
January 03, 2013 07:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.