Home > Archive > MS SQL Server > July 2005 > Delete









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Delete
bjones

2005-07-18, 11:23 am

I am trying a delete statement as follows which is taking a long time
although the tables concerned are not large.

delete from table where value not in ('a','b','c'.....'s')

table as a trigger operation to delete from further child tables.

Is there any way to speed this query?
David Gugick

2005-07-18, 1:23 pm

bjones wrote:
> I am trying a delete statement as follows which is taking a long time
> although the tables concerned are not large.
>
> delete from table where value not in ('a','b','c'.....'s')
>
> table as a trigger operation to delete from further child tables.
>
> Is there any way to speed this query?


NOT IN cannot be index optimized. Every time you perform a delete, the
table has to be scanned and the value column checked against each
element in the IN clause. I'm not sure what you mean by "table as a
trigger operation to delete from further child tables". It would help if
you could provide DDL and full explanation of what you need to do.

--
David Gugick
Quest Software
www.imceda.com
www.quest.com

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com