sweta Jha
sweta Jha

Reputation: 33

Delete from tablename takes abnormally long

I've a table in sql server 2005 with a chaild table that has millions of records in it. Whenever I issue a delete command even with a where clause, it takes abnormally long to execute it. Is it bacause the size of the child table that is causing this delay? What are the ways to make the delete query faster?

thanks, sweta.

Upvotes: 3

Views: 598

Answers (2)

gbn
gbn

Reputation: 432421

The usual suspects:

  • Trigger?
  • Index on column(s) in the WHERE clause?
  • Index on FL column(s) in child table FK column?
  • Cascade delete etc: see index points

Also:

  • log file growing?
  • ...

Edit, after comments: You need indexes...

Upvotes: 3

Adam Ruth
Adam Ruth

Reputation: 3655

It sounds like it may be doing a table scan on the child table. Make sure that the joining column has an index on the child table.

Upvotes: 2

Related Questions