Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting millions on records while using log shipping - SQL Server

I'm not very familiar with log shipping and I need to delete 70 million records from a table that contains 71 million records.

My issue is how will log shipping react if I do the following:

  1. Copy the million records that I want to keep, in a new table
  2. Truncate the original table (Truncate Table OriginalTable)
  3. Insert in the original table the million of records

We have limited space for the logs. What will be logged and shipped?

Thanks

like image 753
freddoo Avatar asked May 26 '26 04:05

freddoo


1 Answers

This should be fine - as long as you're not truncating the log, and just truncating the table, log shipping should keep up.

Truncates are logged, just logged efficiently (see https://dba.stackexchange.com/questions/55834/what-does-a-truncate-table-write-to-the-log-file-in-sql-server/55882). You will get logging for the million inserts, but this is probably about as efficient as you can get.

like image 166
Dan Field Avatar answered May 28 '26 18:05

Dan Field



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!