Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 General Discussion
»
Query Optimizer
Query Optimizer
Rate Topic
Display Mode
Topic Options
Author
Message
dreamslogic
dreamslogic
Posted Saturday, June 13, 2009 7:38 PM
SSC Rookie
Group: General Forum Members
Last Login: Thursday, March 15, 2012 3:31 AM
Points: 27,
Visits: 197
You have an SQL query that is referencing multiple tables and views. Using a query optimizer you discover your current views are causing the performance drain. You don’t want to replicate the data your view is using in a Table. Of the following, which solution should you choose?
Post #734502
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Saturday, June 13, 2009 9:42 PM
SSC-Dedicated
Group: Administrators
Last Login: 2 days ago @ 1:47 PM
Points: 31,406,
Visits: 13,722
Which choices?
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #734516
dreamslogic
dreamslogic
Posted Saturday, June 13, 2009 10:16 PM
SSC Rookie
Group: General Forum Members
Last Login: Thursday, March 15, 2012 3:31 AM
Points: 27,
Visits: 197
Hi Steve - Here are the choices
Create a new View
Use a cursor and store the data in a temporary table
Create an Indexed View
Create a User Defined Function to return the needed data
Create a new Table
Post #734527
RBarryYoung
RBarryYoung
Posted Saturday, June 13, 2009 11:49 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Saturday, May 04, 2013 11:13 AM
Points: 9,855,
Visits: 9,374
dreamslogic (6/13/2009)
Hi Steve - Here are the choices
Create a new View
Use a cursor and store the data in a temporary table
Create an Indexed View
Create a User Defined Function to return the needed data
Create a new Table
That would have an awful lot to do with what the supposed problem with the old views was. Views do not usually cause performance problems, but using them inefficiently can.
-- RBarryYoung
,
(302)375-0451
blog:
MovingSQL.com
, Twitter:
@RBarryYoung
Proactive
Performance Solutions, Inc.
"Performance is our middle name."
Post #734538
GilaMonster
GilaMonster
Posted Sunday, June 14, 2009 3:46 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Yesterday @ 12:59 PM
Points: 37,640,
Visits: 29,895
dreamslogic (6/13/2009)
Hi Steve - Here are the choices
Create a new View
Use a cursor and store the data in a temporary table
Create an Indexed View
Create a User Defined Function to return the needed data
Create a new Table
None of the above. Rewrite the query and/or view so that they are written optimally and add any necessary indexes.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #734571
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Sunday, June 14, 2009 9:18 AM
SSC-Dedicated
Group: Administrators
Last Login: 2 days ago @ 1:47 PM
Points: 31,406,
Visits: 13,722
Or provide more information. A view isn't anything more than a query that is written over a table(s). The query optimizer looks at that query and includes it in the query you are writing on a view, looking to optimize things.
There is no general advice outside of don't use a cursor.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #734609
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.