Skip navigation links

MySQL Forums :: General :: Sub Query is Very Slow


Advanced Search

Sub Query is Very Slow
Posted by: Asad ahmed ()
Date: December 02, 2011 11:33PM

I have a subquery which takes less than a second in SQL server server 2005 where as when I run this on MySQL Server 5.5 it is very very very slow my query is as follows:

select articlenumber from temp_tag
where articlenumber not in (
select distinct cont from temp_tag where heading is not null
and heading <> '' and publishdate='2011-10-20'
and type = 'story' and cont <> '0')

some one suggested me following Query but this is also very slow:

select outer.articlenumber from temp_tag AS outer LEFT JOIN temp_tag AS inner
ON outer.articlenumber=inner.cont and inner.heading is not null
and inner.heading <> '' and inner.publishdate='2011-10-20'
and inner.type = 'story' and inner.cont <> '0'
WHERE inner.heading IS NULL


please help me as i am about to scratch my hairs :-(

Options: ReplyQuote


Subject Written By Posted
Sub Query is Very Slow Asad ahmed 12/02/2011 11:33PM
Re: Sub Query is Very Slow Peter Brawley 12/03/2011 01:38PM
Re: Sub Query is Very Slow Asad ahmed 12/04/2011 10:52PM
Re: Sub Query is Very Slow Peter Brawley 12/05/2011 02:30AM
Re: Sub Query is Very Slow Asad ahmed 12/05/2011 03:15AM
Re: Sub Query is Very Slow Rick James 12/05/2011 11:44PM
Re: Sub Query is Very Slow Rick James 12/05/2011 11:48PM
Re: Sub Query is Very Slow Asad ahmed 12/06/2011 02:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.