Solved

Stored Procedures Performance Tuning in SQL Server

Posted on 2013-05-23
4
590 Views
Last Modified: 2013-05-28
Hi, I am new to performance tuning of stored procedures. I got to improve the performance
of a particular stored procedure which is making application to load the page slowly.
The front end application is .net and DB is SQL Server 2008.

Can any one please let me know how do I debug the stored proc to see which part of the stored proc
is taking too much time ? do i need to use any execution plans ?

Many Thanks
0
Comment
Question by:gvamsimba
  • 2
4 Comments
 
LVL 8

Expert Comment

by:didnthaveaname
ID: 39190758
I would run a profiler trace while you hit the page making the request. Hopefully there's a specific app name created in the connection string for the webapp so you can filter your results for that. Otherwise, it should default to .net something rather. The things you're interested in are how long the query takes to complete and the actual query being executed. I usually like to copy/paste out the query and execute it in ssms to see if it runs faster or not. From there, I absolutely recommend looking at the actual execution plan to see where the heaviest lifting is going on and then focus in on that. Ssms may even be kind enough to recommend missing indexes that can support the query.
0
 

Author Comment

by:gvamsimba
ID: 39190830
Many thanks, can you please let me know how to use the execution plans in an effective manner ?
How do we know if any indexes are to be added or modified ?
Thanks
0
 
LVL 8

Accepted Solution

by:
didnthaveaname earned 500 total points
ID: 39191024
If SSMS detects it, you will see a little info bar beneath the query.  If you're looking through the execution plan, I'd look for any sequential scans that are in there.  As just a general rule of thumb, any iterative operations should be carefully analyzed to see if there are any set based solutions.  Here's a good intro to execution plans: http://www.mssqltips.com/sqlservertip/1873/how-to-read-sql-server-graphical-query-execution-plans/
0
 
LVL 34

Expert Comment

by:Brian Crowe
ID: 39191677
if you can, post your stored procedure text here and we can look for any obvious issues.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Server 2008 Cluster Fail-over Errors 5 46
Numeric sequence in SQL 14 37
Convert int to military time 8 20
replication - alerts? 4 23
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now