sys.dm_exec_query_stats

  • Is there a way to know which query plan added last 5 minutes into sys.dm_exec_query_stats by date .
    Thank you in advance

  • The creation_time column - is that what you're looking for?

    John

  • Thank you,
    I know has creation_time and  last_execution_time, not sure if that means any new query plan added, I mean any new that never executed before or not in DMV sys.dm_exec_query_stats

    in more details: I need to record all unique query plans that sys.dm_exec_query_stats, as you know sys.dm_exec_query_stats as you know sys.dm_exec_query_stats clears out after sql restart or plan cleared.

  • You've posted in the SQL Server 2008 forum.  Is that the actual version you're using?  If so, I don't think there's anything you can do, short of capturing all plans at very short intervals and comparing that to what's already in the plan cache.  If you have SQL Server 2016 or later, you may be able to use the Query Store to get what you're looking for.

    John

  • Yes sql 2008

    Thanks

  • Sounds like you're trying to recreate the functionality from the Query Store. I'd suggest you take a look at this open source project. It may help.

    "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

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply