Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have been able to run the following code to gather statistics of adaption of SQL Server 2016+ functions, however these counters reset on system reboots.

SELECT
    DB_NAME(fs.database_id) DatabaseName,
    OBJECT_NAME(object_id, database_id) FunctionName,
    fs.cached_time, fs.last_execution_time, fs.total_elapsed_time,
    fs.total_worker_time, fs.total_logical_reads, fs.total_physical_reads,
    fs.total_elapsed_time/fs.execution_count AS [avg_elapsed_time],
    fs.last_elapsed_time, fs.execution_count
FROM
    sys.dm_exec_function_stats AS fs
WHERE
    1=1
    AND NOT DB_NAME(fs.database_id) IN ('master','msdb')
ORDER BY [total_worker_time] DESC

Is there a location in SQL Server that will give me the over all statistics over the lifetime of the instance that I haven't yet found?

question from:https://stackoverflow.com/questions/65672121/sql-server-count-of-function-usages

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
230 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...