当我更改索引视图的架构时,为什么我的索引会被删除?

发布于 2024-08-07 07:44:45 字数 229 浏览 5 评论 0原文

服务器:MS Sql Server 2008

当我创建索引视图..然后更改视图的架构时,索引全部被删除。

真是太烦人了!

有人可以解释这是为什么吗?起初我认为这可能是因为索引所需的字段不再位于架构中(我们只是更改了它,对吧?)...但是对于索引字段始终位于视图架构中的情况。 ..它应该把索引留在那里。

无论如何..咆哮咆哮...

只是希望有人对此有一些内部知识。

Server: MS Sql Server 2008

When i create an indexed view .. and i then alter the view's schema, the index's all get dropped.

It's sooo annoying!

Can someone explain why this is? At first I thought that it could be because the fields the index requires are not in the schema any more (we did just alter it, right?) .... but for all the times when the index fields are in the view schema ... it should just leave the index there.

anyways.. rant rant rant ...

just hoping someone might have some inside knowledge on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

回心转意 2024-08-14 07:44:45

该行为是设计使然。来自在线书籍:

ALTER VIEW 可应用于索引
意见;然而,改变视图
无条件删除所有索引
视图。

当您修改架构时,必须重建聚集索引。由于所有非聚集索引都依赖于聚集索引,因此必须重建它们。这可能就是所有索引都被删除的原因。

The behavior is by design. From Books Online:

ALTER VIEW can be applied to indexed
views; however, ALTER VIEW
unconditionally drops all indexes on
the view.

When you modify the schema, the clustered index will have to be rebuilt. Since all non-clustered indexes rely on the clustered index, they have to be rebuilt. That's probably why all the indexes are dropped.

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