[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

lmsiva

3/30/2007 7:56:00 PM

Hi,
I have 3 views V1, V2, V3. I created a view V123, which combines three
previous views. In the report I use the view V123. The report filters ( date
and time and few more fields are applied only on the fields coming from V1 ).
In this case, will the entire table used for the views V2 and V3 be brought
in to memory for processing or will the filters applied on V1 would restrict
the data on the other views as well due to the joins used between the three
views to create V123.

Basically, when you have nested views and if the data filter is used only on
one of the view used in the nested view, what happens to other views used in
the nested view.

Appreciate your help.

Thanks,
Latha


4 Answers

Alejandro Mesa

3/30/2007 8:42:00 PM

0

lmsiva,

Unless those views are materialized ones, SQL Server will use the view's
definition because views are just that, a definition. Thinks about
macro-substitution, the concet is similar to that.

AMB

"lmsiva" wrote:

> Hi,
> I have 3 views V1, V2, V3. I created a view V123, which combines three
> previous views. In the report I use the view V123. The report filters ( date
> and time and few more fields are applied only on the fields coming from V1 ).
> In this case, will the entire table used for the views V2 and V3 be brought
> in to memory for processing or will the filters applied on V1 would restrict
> the data on the other views as well due to the joins used between the three
> views to create V123.
>
> Basically, when you have nested views and if the data filter is used only on
> one of the view used in the nested view, what happens to other views used in
> the nested view.
>
> Appreciate your help.
>
> Thanks,
> Latha
>
>

lmsiva

3/30/2007 11:30:00 PM

0

Alejandro, Thanks for the reply. I am not very sure, if I understand it fully
though. It is clear to me that views are like Macro definition but what I am
not sure is, Is there a performance difference if I were to apply the data
filters on each of the view and then join the data from individual views
versus apply the filters on V1 fields on the combined view.

In my case, the data filters that I apply on V1 can not be applied as is on
the other views, I have to do some lookups.


"Alejandro Mesa" wrote:

> lmsiva,
>
> Unless those views are materialized ones, SQL Server will use the view's
> definition because views are just that, a definition. Thinks about
> macro-substitution, the concet is similar to that.
>
> AMB
>
> "lmsiva" wrote:
>
> > Hi,
> > I have 3 views V1, V2, V3. I created a view V123, which combines three
> > previous views. In the report I use the view V123. The report filters ( date
> > and time and few more fields are applied only on the fields coming from V1 ).
> > In this case, will the entire table used for the views V2 and V3 be brought
> > in to memory for processing or will the filters applied on V1 would restrict
> > the data on the other views as well due to the joins used between the three
> > views to create V123.
> >
> > Basically, when you have nested views and if the data filter is used only on
> > one of the view used in the nested view, what happens to other views used in
> > the nested view.
> >
> > Appreciate your help.
> >
> > Thanks,
> > Latha
> >
> >

mesaalejandro

3/30/2007 11:56:00 PM

0

lmsiva,

Check the execution plan.

AMB

"lmsiva" <lmsiva@discussions.microsoft.com> wrote in message
news:89343BC7-0121-4E28-8B14-3369A5194F98@microsoft.com...
> Alejandro, Thanks for the reply. I am not very sure, if I understand it
> fully
> though. It is clear to me that views are like Macro definition but what I
> am
> not sure is, Is there a performance difference if I were to apply the data
> filters on each of the view and then join the data from individual views
> versus apply the filters on V1 fields on the combined view.
>
> In my case, the data filters that I apply on V1 can not be applied as is
> on
> the other views, I have to do some lookups.
>
>
> "Alejandro Mesa" wrote:
>
>> lmsiva,
>>
>> Unless those views are materialized ones, SQL Server will use the view's
>> definition because views are just that, a definition. Thinks about
>> macro-substitution, the concet is similar to that.
>>
>> AMB
>>
>> "lmsiva" wrote:
>>
>> > Hi,
>> > I have 3 views V1, V2, V3. I created a view V123, which combines
>> > three
>> > previous views. In the report I use the view V123. The report filters
>> > ( date
>> > and time and few more fields are applied only on the fields coming from
>> > V1 ).
>> > In this case, will the entire table used for the views V2 and V3 be
>> > brought
>> > in to memory for processing or will the filters applied on V1 would
>> > restrict
>> > the data on the other views as well due to the joins used between the
>> > three
>> > views to create V123.
>> >
>> > Basically, when you have nested views and if the data filter is used
>> > only on
>> > one of the view used in the nested view, what happens to other views
>> > used in
>> > the nested view.
>> >
>> > Appreciate your help.
>> >
>> > Thanks,
>> > Latha
>> >
>> >


--CELKO--

3/31/2007 12:37:00 AM

0

Get a copy of SQL FOR SMARTIES and read the section on nested VIEWs
that have various WITH CHECK OPTION clauses. Huge differences are
possible.