数据库维护

发布于 2024-08-14 03:39:36 字数 266 浏览 6 评论 0原文

我正在尝试对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人心善变 2024-08-21 03:39:36

您可以在数据库中执行这些步骤,但这取决于是否需要它们。

例如,如果您的数据库配置为自动更新统计信息,则通常不需要第一步。 (通过运行 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文