Thursday, March 29, 2012

deleting records takes forever

hi there.
I've got a bit of a problem on a clustered sql server. I don't know
if the cluster has anything to do with it, this is an entirely new
configuration for our company. We've moved out of the days of using
"white-box" pcs for servers to two dl380s clustered with an msa 1000
via fibre.
the servers are win2000 ent
mssql 2000 ent sp 3 (iirc)
with the advent of all this great technology, the big-brains
determined an excellent way to recoup costs of such an expense is to
release our dba. nice.
anyway. I've never run into this so I'm posting to this group, musing
whether this is due to clustering, table indexes or something else.
The cluster appears to be set up fine and we (small-brains) even
decided it was preduent to invest the money in calling MS for support.
Here'e the heart of the issue...
When deleting records from tables with indexes (mostly), by the index,
it takes absolutely forever. It took 8.5 hours to delete 1300 rows.
These are simple indexes, one field each, two indexes per table.
I say mostly because of the following:
deleting by the index, long time
deleting not by the index, fine execution
some tables, not deleting by the index, long time
example, contract table has two indexes on enteredby and contractid
(there are other objects, sps, views, triggers, constraints, etc.)
delete * from contract where enteredby = 5 and contractid < 1000
extremely long time to execute
delete * from contract where enteredby = 5
and
delete from contract where contractid < 1000
extremely long time
delete from contract where program > 1
fine execution
in another table - reports - deleting anything from that table results
in a long execution time whether i'm using indexes or not.
Now, when I select into another table (iirc just copies the data) and
perform any of the above (even on the reports table) execution is
perfect. Deletes several hundred rows <1 second.
Can anyone give me some guidance here?
thanks
>delete * from contract where enteredby = 5 and contractid < 1000
yeah, I know i messed that up

> decided it was preduent to invest the money in calling MS for support.
that too if anyone else noticed
|||Thanks for the suggestions.
In the event this ever gets indexed, it turned out that there were
constraints on the Comments table that referenced the Contract table.

No comments:

Post a Comment