Alex Pilson wrote:

I have this query below than seems to be running really slow. I have tried indexing key JOIN fields but it seems to have not helped. Any pointers would be greatly appreciated.

(ver: MySQL 3.23.53) side note: seems to run fairly quick in 4.0.18

SELECT
dl.email as download_email, CONCAT(dl.first, " ", dl.last) as download_name, o.id as orderID,
c.id as cust_id, dl.id as dlId, c.email as customer_email


FROM download_users as dl

LEFT JOIN orders as o ON dl.email = o.email
LEFT JOIN customers as c ON
(dl.email=c.email
OR c.id = o.cust_id
OR concat(dl.first, dl.last) = concat(c.bill_first,c.bill_last))

GROUP BY download_email

ORDER BY orderID DESC, cust_id DESC

As far as I know, MySQL 3.23 doesn't use index for a query with OR clause (exept rare cases). so you end up with a full table scan.. (quiet slow, isn't it ?). I don't see anything to speed this up.



-- Philippe Poelvoorde COS Trading Ltd.

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



Reply via email to