SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Stored Procedures Performance


Stored Procedures Performance

Author
Message
adnan.korkmaz
adnan.korkmaz
SSC-Enthusiastic
SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)

Group: General Forum Members
Points: 124 Visits: 167
Comments posted to this topic are about the item Stored Procedures Performance
Eric M Russell
Eric M Russell
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: General Forum Members
Points: 35480 Visits: 11772
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
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2731 Visits: 4381
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 (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 6
Good One ....
caoxp930
caoxp930
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 193
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 Eights!
SSC Eights! (965 reputation)SSC Eights! (965 reputation)SSC Eights! (965 reputation)SSC Eights! (965 reputation)SSC Eights! (965 reputation)SSC Eights! (965 reputation)SSC Eights! (965 reputation)SSC Eights! (965 reputation)

Group: General Forum Members
Points: 965 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-Enthusiastic
SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)

Group: General Forum Members
Points: 124 Visits: 167
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
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2581 Visits: 2043
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])


;-)

gsc_dba
Sean Smith (SSC)
Sean Smith (SSC)
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1673 Visits: 1016
Very nice. Smile
Mike Stuart
Mike Stuart
SSC Veteran
SSC Veteran (222 reputation)SSC Veteran (222 reputation)SSC Veteran (222 reputation)SSC Veteran (222 reputation)SSC Veteran (222 reputation)SSC Veteran (222 reputation)SSC Veteran (222 reputation)SSC Veteran (222 reputation)

Group: General Forum Members
Points: 222 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