SELECT * #Case 1 cp.* #Case 2 FROM crawl_page AS cp LEFT JOIN artist AS a ON cp.cpURL LIKE CONCAT('%',a.artistPageID,'/',a.artistPageURL,'%') WHERE cpPageType = 'SONGS' AND cpPageAdded < ( SELECT cpCrawlDate FROM crawl_page WHERE cpURL = 'http://www.example.com/page-52/' ) AND a.artistID IS NULL LIMIT 1
In this query when I use 1st case (selecting everything from both tables) time taken for query is fine about 0.468 sec.
But if I do case 2 (selecting only from main table) it takes hell much time 26 second.
It's not problem just to use case 1, but I can't get the idea how does it work and why?