MySQL Forums
Forum List  »  Optimizer & Parser

Re: MySQL can't find index = really slow query...
Posted by: Bob Field
Date: September 25, 2006 08:49AM

The first thing I'd do is to convert to the new ANSI syntax, organization the joins and join conditions into some sort of order:
SELECT a.PRATICA_ID, p.situaz, p.tipo_prat, d.ragsoc, d.telefono, d.indirizzo, d.comune_id, c.descr, c.provincia_ID, pr.descrizione, pr.regione_ID, r.regione_ID, r.descrizione, p.importo_capitale, n.notecli
FROM affidamenti_procuratore AS a
JOIN pratiche AS p          ON p.pratica_ID = a.pratica_ID
JOIN noteprat AS n          ON n.pratica_ID = p.pratica_ID
JOIN anagrafe_debitori AS d ON p.anagrafe_debitore_ID = d.anagrafe_debitore_ID
JOIN comuni AS c            ON c.comune_ID = d.comune_ID
JOIN province AS pr         ON pr.provincia_ID = c.provincia_ID
JOIN regioni AS r           ON r.regione_ID = pr.regione_ID
WHERE a.anagrafe_procuratore_ID = 4
AND a.fine IS NULL
AND n.pratica_ID=34054
Then run an EXPLAIN and post the result.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: MySQL can't find index = really slow query...
1817
September 25, 2006 08:49AM


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.