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
»
Administering
»
SQL 2005 - Long duration Stored Procedure
SQL 2005 - Long duration Stored Procedure
Rate Topic
Display Mode
Topic Options
Author
Message
balasach82
balasach82
Posted Friday, March 19, 2010 11:16 AM
Old Hand
Group: General Forum Members
Last Login: Monday, June 10, 2013 6:23 PM
Points: 311,
Visits: 757
I use a Stored Procedure (with parameter) which uses 3/4 joins to retrieve some fields.i.e., a select from 3/4 tables. The problem is whenever the SP is executed for a particular input for the first time, it takes 5 to 6 mins to retrieve records(1 to 100). But the same SP for the same parameter after that completes in a shorter duration. If the parameter is changed, then it takes similarly long time, but the second execution for the same parameter in shorter duration.
Execution plan does not have any table scan.
There are indexes present in all the tables.
recompiling SP, Freeing cache does not have desired effect.
SQL 2005
Any recommendations?
Post #886593
SQLRNNR
SQLRNNR
Posted Friday, March 19, 2010 12:01 PM
SSCoach
Group: General Forum Members
Last Login: Today @ 5:03 PM
Points: 18,853,
Visits: 12,438
balasach82 (3/19/2010)
I use a Stored Procedure (with parameter) which uses 3/4 joins to retrieve some fields.i.e., a select from 3/4 tables. The problem is whenever the SP is executed for a particular input for the first time, it takes 5 to 6 mins to retrieve records(1 to 100). But the same SP for the same parameter after that completes in a shorter duration. If the parameter is changed, then it takes similarly long time, but the second execution for the same parameter in shorter duration.
Execution plan does not have any table scan.
There are indexes present in all the tables.
recompiling SP, Freeing cache does not have desired effect.
SQL 2005
Any recommendations?
Freeing cache will make it slower on the next run as well.
Do you have appropriate indexes?
Have you checked for parameter sniffing?
how do the statistics appear for your tables?
How is the index fragmentation level?
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #886626
MANU-J.
MANU-J.
Posted Friday, March 19, 2010 2:51 PM
SSCommitted
Group: General Forum Members
Last Login: Monday, June 10, 2013 5:07 AM
Points: 1,658,
Visits: 8,570
http://www.databasejournal.com/features/mssql/article.php/3841271/T-SQL-Best-Practices--Parameter-Sniffing.htm
MJ
Post #886731
« 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.