数据库维护
我正在尝试对 SQL Server 2005 数据库进行一些基本维护。它相当小(10GB大小,50个表左右)。
我首先对所有表执行以下操作:
update statistics [table name] with fullscan
然后重新索引所有表。
DBCC REINDEX ([table name], ...)
这是正确的吗?顺序对吗?我需要两者都做还是一个就足够了?
I am trying to do some basic maintenance on a SQL Server 2005 database. It's fairly small (10gb in size, 50 tables or so).
I am first doing the following on all tables:
update statistics [table name] with fullscan
followed by reindexing all tables.
DBCC REINDEX ([table name], ...)
Is this correct? Is the sequence right? Do I need to do both or is one enough?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在数据库中执行这些步骤,但这取决于是否需要它们。
例如,如果您的数据库配置为自动更新统计信息,则通常不需要第一步。 (通过运行 sp_updatestats 存储过程也可以更轻松地完成第一步。)
第二步(重新创建索引)是一个昂贵的步骤,只有在存在性能问题时我才会考虑这样做与数据库。
You can do these steps in your database, but it depends whether they are needed or not.
For example if your database is configured to automatically update statistics, the first step usually will not be needed. (This first step can also be done easier by running the
sp_updatestats
stored procedure.)The second step (recreating the indexes) is an expensive step, and I would only consider doing it, if there are performance problems with the database.