November 6, 2003 at 3:17 am
Hi all,
I am getting some problems with the query,, The query is talking a long time to execute..
Is there any way you can suggest to optimize my query
here is my query:
delete from table1 where (NEWS_LETTER_ID in
("FLOWERS","BOUQUETS") or NEWS_LETTER_ID like
'newsletter%') and (REGISTERED_ID=(select from IDTABLE where ID='key1'))
November 6, 2003 at 5:42 am
Well... if you copied the query here correctly, then "select from" is wrong - you have to specify what to select (e.g. select ID from ...). However, IMHO such query wouldn't take long to execute - it would fail rather quickly, so I'm not sure whether it is a typo or the real problem.
Just how many records are in the table1, and how many of them will you delete with this statement? Greater deletes work better when divided into several small batches. If you replace "delete" with "select *", how long will it take to execute?
November 6, 2003 at 5:58 am
I'm sorry that I posted a mistake in my query. Here is the query. Can Any one say how to optimize it.
-------------------------------------------
delete from table1 where ((NEWS_LETTER_ID in
("FLOWERS","BOUQUETS") or NEWS_LETTER_ID like
'newsletter%')) and (REGISTERED_ID=(select ID from IDTABLE where EMAIL_ADDRESS='key1'))
Any suggestion is greatly appreciated
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply