Top 10 most expensive queries
I need some help please. I have to build and distribute an daily SSRS report showing the top 10 queries from the previous day, by execution count, total duration etc. The current RedGate provided SSRS samples (and scripts they contain) do not cover this topic. I am aware that querying the RedGate SQL Monitor database directly isn't supported and anything I build against it might break in the future, that is perfectly acceptable.
I can see the data I need in [Cluster_SqlServer_TopQueries_UnstableSamples] and figured out how to query it via your indexes and FK's. The problem is that my results do not match those shown on SQL Monitor itself. I am probably querying the tables wrong or might be using the [Id] incorrectly to get to the stored procedure name via the SqlHandle.
Does anyone perhaps have a sample script I could use as a reference?