April 29, 2010 at 1:33 am
Hello,
Please can you tell me if I can and how can I see the usage of a function?
I mean... I want to know how many times is a certain (or all) function used.
Wish you good ideas! 🙂
Andreea
April 29, 2010 at 3:30 am
Because on the production db the compatibility level is 80, I have run on master database (90) the query below that does almost what I wanted...
SELECT
sql.dbid
sql.text
max(s.last_execution_time)[LastExecDate],
sql.objectid [ObjectId],
count(*) [Total]
FROM sys.dm_exec_query_stats s
CROSS APPLY sys.dm_exec_sql_text(s.sql_handle) sql
WHERE
sql.dbid IN (5)
GROUP BY sql.dbid ,sql.text,sql.objectid
...
Wish you good ideas! 🙂
Andreea
April 29, 2010 at 11:23 am
The best way to monitor object useage is through a Profiler Trace. Server-side is more efficient that GUI version, but either works. Filter your trace to look only for the object_id of that function and you should be able to get a good gauge for how many times across the day it's called.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply