Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Removing Audit History - SQL School Video Expand / Collapse
Posted Monday, March 9, 2009 11:56 PM


Group: Moderators
Last Login: Today @ 8:46 AM
Points: 7,062, Visits: 2,662
Comments posted to this topic are about the item Removing Audit History - SQL School Video

SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #672178
Posted Thursday, March 12, 2009 9:43 AM


Group: General Forum Members
Last Login: Thursday, November 1, 2012 1:18 PM
Points: 110, Visits: 261
If your trim job has any significant number of rows in it, it is generally advisable to expire the rows in batches of N rows. One very easy way to implement this is to do:
set rowcount @pBatchCntDelete -- Limit number of rows to select
and then run the delete in a loop until no rows are affected.

Of course it will perform far better if you can base your deletions on the clustered key. If you aren't using an index and have to delete by table scan, then you would not want to batch the delete as above.
Post #674382
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse