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 (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)

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

Group: General Forum Members
Points: 57445 Visits: 12563
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
SSCarpal Tunnel
SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)

Group: General Forum Members
Points: 4292 Visits: 4462
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 (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 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
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: 1621 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 (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)SSC-Enthusiastic (196 reputation)

Group: General Forum Members
Points: 196 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
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3395 Visits: 2065
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)
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: 2628 Visits: 1039
Very nice. Smile
Mike Stuart
Mike Stuart
SSC Veteran
SSC Veteran (294 reputation)SSC Veteran (294 reputation)SSC Veteran (294 reputation)SSC Veteran (294 reputation)SSC Veteran (294 reputation)SSC Veteran (294 reputation)SSC Veteran (294 reputation)SSC Veteran (294 reputation)

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