Reply to Re: DELETE FROM - Somethings not right

Your name:

Reply:


Posted by David Portas on 02/25/06 11:33

nnelson wrote:
> I have a base customer table of 2 million records. We're doing some
> testing and I added 33000 rows incorrectly. No biggie, we'll just
> delete them, right? Nope....9 hours later, process is still running
> using this query.
>
> delete from customer where custid in (select custid from #tmp1)
>
> k...so we'll change it.
>
> delete from customer where custid > 2295885
>
> 2 hours later, still going slower than a turtle...literally 1 row per
> second.
>
> custid is my primary key so you can't tell me it's not indexed. It's
> pretty bad when I have to resort to doing a restore of my entire
> database of 27GB because it's faster than deleting 33000 rows.
>
> WTF?

Do you have any unindexed foreign key's referencing the table? Not
indexing foreign keys can seriously hurt DELETE performance.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация