Reducing the overall log size from a SP that deletes data in groups

  • A stored procedure (SP) has been created that deletes data in loop for each group. So if there are 5 groups, the delete occurs 5 times one in each time thru the loop. The database is in simple recovery. The size of the log as a result of running the seems is proportional to the number of groups and thus is 1 big log. If this was a script, I would have a Go at the end of each loop thus allowing the log to be reused at the next checkpoint. The log size is then only the largest delete group. In a SP the GO is not there and the log is now the size of all the groups. In the current version of the SP the log is 500GB. I want to reuse the log to be only ~100GB. Would moving the delete portion of the group to another child callable SP help reduce the log size? Any other options?

  • You could use dynamic SQL for each DELETE, thus having a separate sql command executed for each group.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply