January 25, 2018 at 5:22 am
SELECT
January 25, 2018 at 5:36 am
That will only show the most recent plan for the stored procedure in the plan cache. Query Store in SQL Server 2016 and above may help. Otherwise, you'll need to include some logic in the stored procedure itself to record individual executions.
John
January 25, 2018 at 6:49 am
For when the procedure was created, look at the create date in sys.procedures. SQL doesn't track the last execution date except as tied to the plan (which is not necessarily in cache). Implement some custom monitoring, or put something into the procedure to track its executions.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 25, 2018 at 9:00 am
The best way to monitor this in 2012 would be using Extended Events. However, it does require that you set it up and maintain it. There's nothing automatic that does this for you.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
January 26, 2018 at 2:22 am
maybe this helps to get the last execution time from the cache available , try
SELECT DB_NAME(database_id)
,OBJECT_NAME(object_id)
,cached_time
,last_execution_time
,execution_count
FROM sys.dm_exec_procedure_stats
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply