视图和视图定义语句的不同查询计划 [英] Different query plans for view and view definition statement

查看:87
本文介绍了视图和视图定义语句的不同查询计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我从视图定义运行相同的语句

并将获得不同的结果,我将查询查询计划与查询计划进行了比较。查看计划更贵,而且运行时间更长。 View包含4个内部联接,统计数据为所有表更新
。有什么想法吗?

I compared view query plan with query plan if I run the same statement
from view definition and get different results. View plan is more
expensive and runs longer. View contains 4 inner joins, statistics
updated for all tables. Any ideas?

推荐答案

哪个版本?

which version?


带有SP4的SQL Server 2000企业版

SQL Server 2000, Enterprise Edition with SP4


ysfinks(ys*****@gmail.com)写道:
ysfinks (ys*****@gmail.com) writes:
如果我从视图定义运行相同的语句并获得不同的结果,我将视图查询计划与查询计划进行了比较。查看计划更昂贵且运行时间更长。视图包含4个内部联接,为所有表更新统计信息。有什么想法?
I compared view query plan with query plan if I run the same statement
from view definition and get different results. View plan is more
expensive and runs longer. View contains 4 inner joins, statistics
updated for all tables. Any ideas?




既然你没有接近任何一个复制品的东西,我几乎不知道

你在做什么。由于一个视图必不可少的是一个宏,它应该不会那么重要。然后,我以前错了。无论如何,如果您发布了视图,那么
将有所帮助,并且您运行的是两个SELECT。

-

Erland Sommarskog,SQL Server MVP , es****@sommarskog.se


SQL Server 2005联机丛书在
http:// www .microsoft.com / technet / pro ... ads / books.mspx

SQL Server 2000联机丛书
http://www.microsoft.com/sql/prodinf...ons/books.mspx



Since you didn''t share anything close to a repro, I have little idea
of you what you are doing. Since a view essential is a macro, it should
not matter that much. Then again, I''ve been wrong before. Anyway, it
would help if you posted the view, and the two SELECT you run.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


这篇关于视图和视图定义语句的不同查询计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆