Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
MISO
Starting Member
3 Posts |
Posted - 2003-11-06 : 05:24:11
|
| how can i get this query to be optimized as its taking time to executedelete from table1 where (NEWS_LETTER_ID in("FLOWERS","BOUQUETS") or NEWS_LETTER_ID like'newsletter%' ) and (REGISTERED_ID=(select from IDTABLE where ID='key1')) |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-11-06 : 05:38:23
|
IndexesA short answer, for a short amount of detail Damian |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-11-06 : 06:52:02
|
| I don't think your query will even compile. Your subquery to the IDTABLE table is malformed.Jay White{0} |
 |
|
|
MISO
Starting Member
3 Posts |
Posted - 2003-11-06 : 07:57:23
|
| 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 |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-11-06 : 08:02:45
|
| See above postDamian |
 |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-11-06 : 08:17:15
|
| I believe Damian is trying to say it is difficult to determine whether this or any other query will be optimized without understanding a few things, to name a few...Your db design.The system intent (ie. what are the most important functions in your system :Retrieval of existing data,extensive Inserts,Updates,etc.. )The query appears optimized, but without knowing more it is difficult to be specific. For instance your query might be optimized but your tables could be inefficient,etc...Perhaps the following indexes ???clusterd index on table1.REGISTERED_IDnonclustered index on table1.NEW_LETTER_ID clusterd index on IDTABLE.ID |
 |
|
|
|
|
|