关于数据库收缩的几点建议

1.数据库收缩会导致大量的索引碎片,这严重影响查询效率
2.任何时候禁用自动收缩
3.在必要的收缩之后,要处理因此而导致的索引碎片问题
收缩大数据库的建议:


 - Create a new filegroup
 
 - Move all affected tables and indexes into the    new filegroup using 
   the CREATE INDEX … WITH (DROP_EXISTING = ON) ON    syntax, to move   
   the tables and remove fragmentation from them at the    same time
   
 - Drop the old filegroup that you were going to shrink anyway    (or   
   shrink it way down if its the primary filegroup)

收缩大数据库的建议:
https://www.sqlskills.com/blogs/paul/why-you-should-not-shrink-your-data-files/
索引碎片整理【建议使用reorganize而不是rebuild】:
https://docs.microsoft.com/en-us/sql/relational-databases/indexes/reorganize-and-rebuild-indexes?view=sql-server-2017
数据库收缩:
https://docs.microsoft.com/en-us/sql/relational-databases/databases/shrink-a-database?view=sql-server-2017

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值