Skip navigation links

MySQL Forums :: Performance :: LEFT JOIN with CASE WHEN


Advanced Search

Re: LEFT JOIN with CASE WHEN
Posted by: Rick James ()
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.

Options: ReplyQuote


Subject Views Written By Posted
LEFT JOIN with CASE WHEN 768 Chad Brogan 10/23/2009 02:25PM
Re: LEFT JOIN with CASE WHEN 285 Stefan Rindeskar 10/23/2009 06:33PM
Re: LEFT JOIN with CASE WHEN 254 Chad Brogan 10/23/2009 09:54PM
Re: LEFT JOIN with CASE WHEN 261 Rick James 10/23/2009 10:29PM
Re: LEFT JOIN with CASE WHEN 246 Chad Brogan 10/25/2009 01:34PM
PARTIAL RESOLUTION - Re: LEFT JOIN with CASE WHEN 230 Chad Brogan 10/27/2009 07:15PM
Re: PARTIAL RESOLUTION - Re: LEFT JOIN with CASE WHEN 85 Chad Brogan 11/14/2009 12:30PM
Re: PARTIAL RESOLUTION - Re: LEFT JOIN with CASE WHEN 77 Rick James 11/17/2009 11:44PM


Sorry, only registered users may post in this forum.