Why do you expect moving the a.timestamp restriction from the WHERE clause to the JOIN will help?

Michael

[EMAIL PROTECTED] wrote:

Yes, I can think of two things you can try in order to speed up your query. First - try the STRAIGHT JOIN clause with one small but critical change to your statement(http://dev.mysql.com/doc/mysql/en/SELECT.html):

SELECT STRAIGHT JOIN *
FROM a
LEFT JOIN b ON a.a_id = b.a_id
        AND a.timestamp BETWEEN 20040101000000 AND 20040101235959
JOIN c ON a.c_id = c.c_id
JOIN d ON c.d_id = d.d_id
JOIN e ON c.e_id = e.e_id
GROUP BY c.d_id, c.e_id

The second thing to try would be to pre-calculate (hand optimize) the different stages of your query (don't join all of the tables together all at once). Although, when I started to do it myself, I was mimicking what the STRAIGHT JOIN should do for us automatically. So I guess I really have only one suggestion, hmmph...

It worked wonders for someone else recently, I think it's what you need for this situation.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to