Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

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

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Monday, November 17, 2014 2:20 PM
Points: 6,800, Visits: 1,914
Comments posted to this topic are about the item Removing Audit History - SQL School Video

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

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

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