替代索引视图

发布于 2024-07-19 14:02:56 字数 59 浏览 6 评论 0原文

sql server 中索引视图的替代方法是什么?

谢谢, 萨尔曼·谢赫巴兹。

Whats the alternate approach to indexed views in sql server?

Thanks,
Salman Shehbaz.

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

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

发布评论

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

评论(4

ぽ尐不点ル 2024-07-26 14:02:59

替代方法包括在常规视图上使用 INSTEAD OF 触发器以及在基表上使用常规触发器。

Alternative approaches inlcude using an INSTEAD OF trigger on a regular VIEW and using a regular trigger on the base tables.

叶落知秋 2024-07-26 14:02:57

创建一个选择存储过程,然后在需要时执行该存储过程。

create a select stored procedure and then execute the stored procedure whever you need it.

仙女 2024-07-26 14:02:57

我假设您想要使用外部联接或自联接对视图进行索引(或其他限制之一)。

如果要在 FROM 子句中使用普通视图或内联表函数,请使用它。

但是,请记住这一点:在具有索引视图的查询中,优化器可能会取消嵌套(展开)视图并使用基表(如果它认为合适)。 使用未索引视图或内联表函数的替代查询也将被嵌套。

在这里查看我的答案:查询计划优化器是否可以很好地与连接/过滤的表值函数配合使用
托尼·罗杰森

否则,您可以添加更多信息吗?

I will assume you want to index a view with an outer or self join (or one of the other limitations).

Use a normal view or in-line table function if you want to use it in a FROM clause.

However, remember this: In a query with indexed views, the optimiser may unnest (expand) the view and use the base tables if it sees fit. An alternative query using unindexed views or in-line table functions would also be nnested.

See my answer here: Does query plan optimizer works well with joined/filtered table-valued functions
And Tony Rogerson

Otherwise, can you add more info please.

香橙ぽ 2024-07-26 14:02:57

将视图内容转储到汇总表并在其上放置索引。

索引视图为您提供了您想要尝试通过替代方法实现的好处

Dumping the view contents to summary tables and putting indices on those instead.

What benefit is it that indexed views provide you with that you'd like to try and achieve with an alternative approach

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