سؤال

Have two semi large related tables (284,6876,609 rows - 156,785,176 KB and 4,2628,162 rows - 2,212,464 KB) in a log shipped db that needs to be either purged or dropped. How can I dispose of these two tables while minimizing impact to log shipping?

هل كانت مفيدة؟

المحلول

If you DROP the tables, it'll cause minimal logs to be generated because it doesn't immediately force garbage collection to occur on the used space, it merely basically just removes the reference. You similarly can accomplish the same outcome with TRUNCATE (though I think on large tables there could be more overhead than DROP, I'll have to research this and update my answer accordingly).

This is a really good article that details why TRUNCATE and DROP operations are seemlessly quick and generate minimal logs, which is due to a feature of SQL Server called deferred drop.

Either way, avoid DELETE otherwise that will generate a ton of logs that will need to get shipped and reapplied at the target database.

This StackOverflow Question has multiple answers with good information about efficiently removing data from a large table (some maybe not specificly related to your question, but good for future reference or other users with similar problems).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى dba.stackexchange
scroll top