我应该删除 SQL Server 创建的表并在其上创建索引吗?
为了消除重建和碎片整理留下的一些碎片 我们认为我们会删除并创建索引,所以我去编写一个脚本。
它识别需要工作的聚集索引并删除索引和主键 并重建表的索引和主键。
这是我遇到的问题:SQL Server 自己创建了很多索引 基于统计数据并拥有自己独特的命名系统。
问题:我是否只想删除并创建我们创建的索引,或者我是否想删除所有索引并仅创建我们创建的索引,或者我们是否想要删除所有索引,包括 SQL Server 创建的索引并创建所有索引(包括 SQL Server 创建的索引)?
In an effort to get rid of some fragmentation left from rebuilding and defraging
we thought that we would drop and create indexes so I went to write a script.
It identifies a clustered index that needs work and drops indexes and primary keys
and rebuilds the indexes and primary keys for a table.
Here is the problem I ran into: SQL Server makes quite a bit of its own indexes
based on statistics with its own unique naming system.
Question: Do I want to only drop and create the indexes we made or do I want to drop all indexes and create only the ones that we made or do we want to drop all indexes including
the ones SQL Server made and create all indexes including the ones that SQL Server made?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终可以对索引进行碎片整理,这比删除并重新创建更容易。 本文对如何执行此操作有一个很好的解释。
You can always defrag your indexes, which is easier than drop and recreate. There's a decent explanation of how to do it in this article.