MySQL Forums
Forum List  »  General

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

Written By
Sub Query is Very Slow
December 02, 2011 11:33PM
December 03, 2011 01:38PM
December 04, 2011 10:52PM
December 05, 2011 02:30AM
December 05, 2011 03:15AM
December 05, 2011 11:44PM
December 05, 2011 11:48PM
December 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.