MySQL Forums
Forum List  »  Optimizer & Parser

Re: JOIN query too slow
Posted by: Peter Brawley
Date: October 14, 2012 10:26AM

Queries are much easier to develop, debug & maintain when joins use aliases and are written using explicit join syntax, ie the base query you show is ...

SELECT 
  p.IdPersona AS id,
  p.NIF AS DNICIF,
  p.Nombre AS Nombre,
  p.Apellidos AS Apellidos,
  p.Email AS Email,
  p.Telefono AS OtrosDatos 
FROM 
  Personas p, 
  Personas_experiencias AS e0 ON p.IdPersona  = e0.IdPersona
  Personas_experiencias AS e1 ON e0.IdPersona = e1.IdPersona
  Personas_experiencias AS e2 ON e1.IdPersona = e2.IdPersona
  Personas_experiencias AS e3 ON e2.IdPersona = e3.IdPersona

As EXPLAIN shows, the base query should execute quickly. If that takes 90 secs on your system, something's seriously amiss with your configuration. You might start with the hints at http://dev.mysql.com/doc/refman/5.5/en/optimizing-queries-myisam.html. Or is it the query with extra clauses that takes 90 secs? In that case, let's see those clauses.

Options: ReplyQuote


Subject
Views
Written By
Posted
2661
October 13, 2012 11:52AM
Re: JOIN query too slow
1327
October 14, 2012 10:26AM
1378
October 16, 2012 07:48PM


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.