dbTalk Databases Forums  

Views

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Views in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dave
 
Posts: n/a

Default Views - 12-17-2008 , 08:37 AM






This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?



Reply With Quote
  #2  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM






On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
  #3  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM



On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
  #4  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM



On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
  #5  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM



On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
  #6  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM



On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
  #7  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM



On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
  #8  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM



On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
  #9  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM



On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
  #10  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Views - 12-17-2008 , 03:46 PM



On Wed, 17 Dec 2008 06:37:15 -0800, Dave wrote:

Quote:
This question pertains to the Query Plan for views.

Assume that I have a table of 10,000 widgets (widgets_table) with a primary
key on the identity column widget_id. Now, assume I have a view
(widgets_view) defined as:

select *
from widgets_table

The plan for the following query (against the view) puts 10,000 rows into
play:

select *
from widgets_view
where widgets_id = 5000

The plan for the following query (against the table) only puts 1 row into
play:

select *
from widgets_table
where widgets_id = 5000

How can I hit the view but get the efficiencies of a table? Are there
hints, compiler options, configuration options, etc... that can be used to
influence the query plan of the view?
Hi Dave,

I'm afraid that either I don't understand your question, or you don't
understand how views are processed internally.

In the example you give above, both queries will return only one row,
and they will use the exact same execution plan.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.