Options

10 Expensive Queries For the Last Week

UnicornsRrealUnicornsRreal Posts: 9
edited January 26, 2012 9:00AM in SQL Monitor Previous Versions
Hi

Is there away to get the most expensive queries for the last 7 days every hour?

Can this be pulled from the database some how?

Comments

  • Options
    Hi

    The repository is not documented sorry but it should be possible to get information from the following three views.

    [data].[Cluster_SqlServer_TopQueries_UnstableSamples_View]
    [data].[Cluster_SqlServer_TopQueries_Instances_View]
    [data].[Cluster_SqlServer_TopQueries_StableSamples_View]

    The function utils.TicksToDateTime() can be used to filter by date. Using something like this:
    WHERE utils.TicksToDateTime(data.Cluster_SqlServer_TopQueries_Instances_View.IdCollectionDate) > DATEADD(day, -7, GETDATE())
    

    It might take a bit of experimentation to get this working.

    Regards
    Chris
    Chris Spencer
    Test Engineer
    Red Gate
Sign In or Register to comment.