Hello and welcome to CertForums.co.uk, here we host free active certification forums with links to the best free resources for Microsoft's MCSA MCSE MCDBA Cisco's CCNA CCDA and CCNP, and CompTIA's A+ Network+ i-NET+ and Security+ certifications in the UK. If you wish to post or use other advanced features you will need to register first. Registration is absolutely free and takes only a few minutes to complete so sign up today!

If you have any problems with the registration process or your account login, please contact support

Go Back   CertForums > Certification Forums > Microsoft Certification Forums > SQL Exams
Home Forums Register Search Today's Posts Mark Forums Read

Large-scale delete in SQL Server 2000

Post New ThreadReply
 
Thread Tools Display Modes
  #1  
Old 12-Feb-2007, 11:26 AM
Gaz 45's Avatar
Gaz 45 Gaz 45 is offline
Valued Member
Posts: 404
Points: 188 Gaz 45 has over 100 pointsGaz 45 has over 100 points
Power: 13
None
Join Date: 17 Oct 2004
Location: Lichfield
Age: 27
Certifications: MCP (70-229, 70-228), MBioch
WIP: MCDBA (70-290)
Large-scale delete in SQL Server 2000

Alright then lads & ladies, anyone have any tips on carrying out large scale deletes (millions of rows) without creating a transaction log bigger than Ayer's rock?

Let's have a discussion!


This style is not free; this style is expensive

Robin: "That's an impossible shot, Batman."
Batman: "That's a negative attitude, Robin."
 
Reply With Quote
  #2  
Old 12-Feb-2007, 09:33 PM
hbroomhall hbroomhall is offline
Premium Member
Posts: 6,281
Points: 2130 hbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 pointshbroomhall has over 2000 points
Power: 89
None
Join Date: 08 Sep 2005
Location: Tunbridge Wells, Kent
Certifications: ECDL A+ Network+ i-Net+
WIP: Server+
What percentage of the total number of rows is that?

If this is high consider doing a SELECT INTO a temp table with the oposite logic, truncate the original, and copy back.

But don't be nasty to the transaction log. That's there so that you can recover from horrors. Treat it nice!

Harry.

 
Reply With Quote
  #3  
Old 12-Feb-2007, 11:55 PM
supag33k's Avatar
supag33k supag33k is offline
Premium Member
Posts: 451
Points: 678 supag33k has over 500 pointssupag33k has over 500 pointssupag33k has over 500 pointssupag33k has over 500 pointssupag33k has over 500 pointssupag33k has over 500 points
Power: 16
None
Join Date: 16 Sep 2005
Location: Australia
Age: 46
Certifications: MCSE (NT4/2000/2003/Messaging), MCDBA
WIP: CCNA, MCTS SQL2005 & Security stuff
Cool

Quote:
Originally Posted by hbroomhall
What percentage of the total number of rows is that?

If this is high consider doing a SELECT INTO a temp table with the oposite logic, truncate the original, and copy back.

But don't be nasty to the transaction log. That's there so that you can recover from horrors. Treat it nice!

Harry.

Yes a very good point about opposite log Harry!

Remeber the difference between logged operations such as DELETE and non logged such as Truncate with regards to the transaction log.

Note that Truncate takes out all rows!

http://www.sql-server-performance.com/misc_tips.asp


supag33k - the chess shark

Administrator www.MCSEworld.com

"Focus your efforts on one certification objective at a time - preferably the one you are weakest on at that point in time - and make the objective something you really understand"
 
Reply With Quote
  #4  
Old 15-Feb-2007, 12:36 PM
zardoz zardoz is offline
New Member
Posts: 14
Points: 0 zardoz has no points
Power: 4
None
Join Date: 23 Nov 2006
Location: Brentwood, UK
Certifications: MCTS
WIP: MCITP
If you want to get rid of everything , truncate.

Otherwise, do your deletes, then do a transaction log backup.
Problem solved.

 
Reply With Quote
  #5  
Old 16-Feb-2007, 05:25 AM
Crito's Avatar
Crito Crito is offline
Valued Member
Posts: 433
Points: 654 Crito has over 500 pointsCrito has over 500 pointsCrito has over 500 pointsCrito has over 500 pointsCrito has over 500 pointsCrito has over 500 points
Power: 15
None
Join Date: 20 Jul 2006
Location: Chattanooga, TN
Certifications: A few
WIP: MCITP: Database Administrator
Not to nit pick, but some people make a big deal about it. Truncate table is technically a minimally logged operation. It doesn't work on individual rows and it won't fire triggers, like a fully logged operation (delete), but it's not quite a non-logged operation either.


Crito Philippatos
MCSE and MCSA on Windows Server 2003, MCTS on SQL Server 2005, MCDBA on SQL Server 2000, A+, Network+, Linux+, Security+, CEH
 
Reply With Quote
  #6  
Old 16-Feb-2007, 08:20 AM
JonnyMX's Avatar
JonnyMX JonnyMX is offline
Lifetime Member
Posts: 2,458
Points: 1590 JonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 pointsJonnyMX has over 1500 points
Power: 46
None
Join Date: 28 Apr 2005
Location: Newport
Age: 36
Certifications: MCSD, i-Net+, Master CIW Designer
WIP: Hmmm...
FORMAT C:



'To err is human, but to really foul things up you need a computer' Anon, 1978
 
Reply With Quote
Post New ThreadReply Spread this thread: Submit this thread to digg Submit this thread to del.icio.us


Go Back   CertForums > Certification Forums > Microsoft Certification Forums > SQL Exams


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server 2005 Compact Edition tuvanit Software 0 15-Dec-2006 12:20 PM
SQL Server Certification sancheetah New Members Introduction 7 18-Oct-2006 10:56 AM
Installing a CA Ally Security Exams 2 21-Jan-2006 11:21 AM
CertForums 70-228 & 70-229 Forum FAQ Page Phil SQL Exams 0 19-Nov-2003 06:24 AM


All times are GMT. The time now is 11:11 PM.

Powered by vBulletin® Version 3.6.11
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
CertForums.co.uk (C) copyright 2003-2007 All Rights Reserved. Content published on CertForums.co.uk requires permission for reprint.
Hosted by Lunarpages