您的位置:首页 > 其它

Case: How To Clean Up Large Table

2012-12-18 09:41 309 查看
We have a large interface table with more than 12m records, unfortunately, most of them are useless, we’d like to clean it up for performance optimization.

Delete useless data by ‘delete from ’ and subsequently shrink the table to lower the HWM? It’s not a good choice. DBA hates that as delete clause would generate huge log, probably the operation would fail.

Truncate the table? I just can’t do that, some data couldn’t be eliminated now.

Here is the DBA’s suggestion:

Step 1: Select the useful data into a new table table_tmp;

Step 2: rename the large table table_origin to table_old;

Step 3: rename table_tmp to table_origin. Now we have a much smaller table_origin with normal HWM.

Step 4: Take care of the indices and the privileges;

Step 5: ensure the table_origin is healthy and then drop table_old;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: