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 2008
»
T-SQL (SS2K8)
»
TSQL joined Views
TSQL joined Views
Rate Topic
Display Mode
Topic Options
Author
Message
Modest DBA
Modest DBA
Posted Thursday, February 21, 2013 1:55 AM
Grasshopper
Group: General Forum Members
Last Login: Yesterday @ 6:45 AM
Points: 13,
Visits: 237
Hi all
I am having some problems understanding this one.
I have a stored proc (written by the developers), that's using up unnecessary resources.
Basically the stored proc makes use of multiple views. These views contain nested conditional select statements.
Each view contains around 1million odd rows and there are around 8 views.
The problem i am having is that i see pressure on the tempdb log files??? why would this be, i can understand tempdb data files being used for caching but log files??? can someone clear this up for me...thanks all!!!!
...One more thing is there any way to make this faster???
thanks all!!!!
Post #1422438
joeroshan
joeroshan
Posted Thursday, February 21, 2013 2:09 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: 2 days ago @ 3:45 AM
Points: 572,
Visits: 1,157
Tempdb may be use while grouping sorting etc.
You should look ate the execution plan and see whether any index/ query rewrite can help.
If you need help please share the execution plan, table structure.
-- Roshan Joe
*******************************************
Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help
Custom cleanup script for backups
Post #1422444
Modest DBA
Modest DBA
Posted Thursday, February 21, 2013 2:16 AM
Grasshopper
Group: General Forum Members
Last Login: Yesterday @ 6:45 AM
Points: 13,
Visits: 237
Well execution plan seems to be using a "hash match(inner join)", do you know anything about this?
although i don't see any #tables?
Post #1422447
joeroshan
joeroshan
Posted Thursday, February 21, 2013 2:33 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: 2 days ago @ 3:45 AM
Points: 572,
Visits: 1,157
Hash match can spill to tempdb.
details on hash join
http://technet.microsoft.com/en-us/library/ms189313(v=sql.105).aspx
-- Roshan Joe
*******************************************
Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help
Custom cleanup script for backups
Post #1422455
Modest DBA
Modest DBA
Posted Thursday, February 21, 2013 2:44 AM
Grasshopper
Group: General Forum Members
Last Login: Yesterday @ 6:45 AM
Points: 13,
Visits: 237
This is my problem exactly! thanks bud!!!
Post #1422461
joeroshan
joeroshan
Posted Thursday, February 21, 2013 2:50 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: 2 days ago @ 3:45 AM
Points: 572,
Visits: 1,157
Glad to help:)
-- Roshan Joe
*******************************************
Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help
Custom cleanup script for backups
Post #1422462
Bhuvnesh
Bhuvnesh
Posted Thursday, February 21, 2013 3:56 AM
SSCrazy
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
Modest DBA (2/21/2013)
One more thing is there any way to make this faster?
Yes and the first step would be tune your stored proc
1 try to restrict the query to required columns
2 apply proper filter which should/must use indexes.
3 if intermediate steps are playing with large volume data , try to store them in temp table have indexes on them and use them in later part.
-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1422488
ScottPletcher
ScottPletcher
Posted Friday, February 22, 2013 1:48 PM
Ten Centuries
Group: General Forum Members
Last Login: Yesterday @ 2:38 PM
Points: 1,318,
Visits: 1,763
Usually views contain lots of columns that aren't really needed when several of them are joined to produce a new result set.
Stop using the views and code directly against the underlying tables when possible, unless the views are just "dummy" views of "SELECT * FROM tablename" to remove dependencies on the actual table name.
SQL DBA,SQL Server MVP('07, '08, '09)
One man with courage makes a majority. Andrew Jackson
Post #1423250
« 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.