Re: LEFT JOIN with CASE WHEN
Date: October 23, 2009 10:29PM
Yeah, those CASEs in the JOIN are bad news. Even this would be better, but not much:
CASE pricing.type WHEN '' THEN pricing.type LIKE '%' ELSE pricing.type = ma.type END AND
-->
(pricing.type = '' OR pricing.type = ma.type) AND
OTOH, this may be a red herring. The EXPLAIN says that it uses the 'date' index to reach into 'pricing' (pricing.date = sales.date). Once it is there, it finds about 1641 rows with the right date. Then (and only then?) it goes through the CASEs.
Sorry, only registered users may post in this forum.
© 1995-2008 MySQL AB, 2008- Sun Microsystems, Inc.