Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Stored Procedures Performance


Stored Procedures Performance

Author
Message
adnan.korkmaz
adnan.korkmaz
SSC Rookie
SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)

Group: General Forum Members
Points: 46 Visits: 166
Comments posted to this topic are about the item Stored Procedures Performance
Eric M Russell
Eric M Russell
SSCertifiable
SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)

Group: General Forum Members
Points: 6033 Visits: 9978
This is a good script.
One suggested addition would be a 'schemaname' column. When I'm unit testing in Development, I often times have a different version of the stored procedure contained under different schema(s), so I can compare their runtime side by side.
select
...
os.schemaname,
...
join (select object_id id, schema_name(schema_id)schemaname
from sys.objects) os on os.id = object_id
...




"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."
SQLQuest29
SQLQuest29
SSC Eights!
SSC Eights! (802 reputation)SSC Eights! (802 reputation)SSC Eights! (802 reputation)SSC Eights! (802 reputation)SSC Eights! (802 reputation)SSC Eights! (802 reputation)SSC Eights! (802 reputation)SSC Eights! (802 reputation)

Group: General Forum Members
Points: 802 Visits: 4316
adnan.korkmaz (5/5/2012)
Comments posted to this topic are about the item <A HREF="/scripts/Stored+Procedures/90129/">Stored Procedures Performance</A>


Good script..

This will only work for SQL server 2008 and plus.

______________________________________________________________________________________________________________________________________________________________________________________
HTH !
Kin
MCTS : 2005, 2008
Active SQL Server Community Contributor :-)
gundaraddy
gundaraddy
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 Visits: 3
Good One ....
caoxp930
caoxp930
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 192
i run it on SQLServer2008 R2, why received the msg:
Msg 208, Level 16, State 1, Line 2
Invalid object name 'sys.dm_exec_procedure_stats'.
Gullimeel
Gullimeel
SSC Veteran
SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)

Group: General Forum Members
Points: 247 Visits: 506
Nice script.

If parallel plan is used in the procedure for any query(ies) then the cpu time doesnt reflect actual cpu time but of the thread which started the proc execution. Thus it sometimes is misleading...

http://www.sqlservercentral.com/Forums/Topic1304371-391-1.aspx

GulliMeel

Finding top n Worst Performing queries
Improve the performance of Merge Join(special case)
How to Post Performance Problem -Gail Shaw
adnan.korkmaz
adnan.korkmaz
SSC Rookie
SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)

Group: General Forum Members
Points: 46 Visits: 166
Hi @caoxp930,

Two possibilities that I can think of:

1) You might have ran the query on a SQL 2005 server, via SQL 2008 interface. The sys.dm_exec_procedure_stats doesn't exist on SQL 2005.
2) You don't have VIEW SERVER STATE permission on the server you are running the query.
gsc_dba
gsc_dba
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1625 Visits: 2004
Eric M Russell (5/7/2012)
This is a good script.
One suggested addition would be a 'schemaname' column. When I'm unit testing in Development, I often times have a different version of the stored procedure contained under different schema(s), so I can compare their runtime side by side.
select
...
os.schemaname,
...
join (select object_id id, schema_name(schema_id)schemaname
from sys.objects) os on os.id = object_id
...



Good suggestion but no need to join unnecessarily - use
OBJECT_SCHEMA_NAME([object_id])


;-)

_____________________________________________________________________________________
[font=Courier New]gsc_dba[/font]
Sean Smith-776614
Sean Smith-776614
SSC-Addicted
SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)

Group: General Forum Members
Points: 491 Visits: 953
Very nice. Smile
Mike Stuart
Mike Stuart
SSC Journeyman
SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)

Group: General Forum Members
Points: 92 Visits: 210
Use extreme prejudice when and where you run DBCC FREEPROCCACHE! SQL Books Online sums this up quite nicely:

Use DBCC FREEPROCCACHE to clear the plan cache carefully. Freeing the plan cache causes, for example, a stored procedure to be recompiled instead of reused from the cache. This can cause a sudden, temporary decrease in query performance.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search