Skip to content

Instantly share code, notes, and snippets.

@srkirkland
Created May 20, 2015 22:01
Show Gist options
  • Save srkirkland/35f4625232cf146c6f8d to your computer and use it in GitHub Desktop.
Save srkirkland/35f4625232cf146c6f8d to your computer and use it in GitHub Desktop.
overall sql stats for the last week
SELECT
avg(avg_cpu_percent) AS 'Average CPU Percentage Used',
max(avg_cpu_percent) AS 'Maximum CPU Percentage Used',
avg(avg_physical_data_read_percent) AS 'Average Physical IOPS Percentage',
max(avg_physical_data_read_percent) AS 'Maximum Physical IOPS Percentage',
avg(avg_log_write_percent) AS 'Average Log Write Percentage',
max(avg_log_write_percent) AS 'Maximum Log Write Percentage',
--avg(avg_memory_percent) AS 'Average Memory Used Percentage',
--max(avg_memory_percent) AS 'Maximum Memory Used Percentage',
avg(active_worker_count) AS 'Average # of Workers',
max(active_worker_count) AS 'Maximum # of Workers'
FROM sys.resource_stats
WHERE database_name = 'PrePurchasing' AND
start_time > DATEADD(day, -7, GETDATE())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment