No.

I had a view called "Web_User":

Select fields from tableA, tableB, tableC where clause

I had another view:

Select fields from tableD, web_user where field_in_web_user = something

And it was extremely slow. However, doing this:

Select fields from tableD, tableA, tableB, tableC where clause and
field_in_tableB = something

Was vastly quicker.

Dino


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Frans Bouma
Sent: Friday, 11 August 2006 22:13
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] SQL Server 2005 Xml question...

> In my experience, that's not correct.

        so, if I have a view, CustomersView SELECT * FROM Customers

        and I have 2 queries:
A:
SELECT * FROM CustomersView
WHERE Country='USA'

B:
SELECT * FROM (SELECT * FROM Customers) CustomersView WHERE
CustomersView.Country = 'USA'

        You're saying A is slower than B?

        Check the execution plans. Most modern RDBMS's will merge the
SQL of the view into the query first, then calculate the execution plan
and then execute it. So a view is more or less just a code snippet.

        It will be different with indexed views which are stored results
and act as tables, there the view usage is much faster, as the query of
the view is bypassed as the results are used directly

                FB


>
> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of Frans Bouma
> Sent: Friday, 11 August 2006 19:13
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] SQL Server 2005 Xml question...
>
>
>         A view is just a query, so a query utilizing a view isn't 
> going to be slower than a query with the view's sql inside it.
>
> ===================================
> This list is hosted by DevelopMentor.  http://www.develop.com
>
> View archives and manage your subscription(s) at 
> http://discuss.develop.com
>
>

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to