Skip to content

Instantly share code, notes, and snippets.

@ghotz
Last active August 4, 2020 10:17
Show Gist options
  • Select an option

  • Save ghotz/d4f18c21b489665420dd11c60e255ed6 to your computer and use it in GitHub Desktop.

Select an option

Save ghotz/d4f18c21b489665420dd11c60e255ed6 to your computer and use it in GitHub Desktop.
Get a quick overview of CPU and memory pressure
SELECT
physical_memory_in_use_kb/1024./1024. AS sql_physical_memory_in_use_gb,
large_page_allocations_kb/1024./1024. AS sql_large_page_allocations_gb,
locked_page_allocations_kb/1024./1024. AS sql_locked_page_allocations_gb,
virtual_address_space_reserved_kb/1024./1024. AS sql_VAS_reserved_gb,
virtual_address_space_committed_kb/1024./1024. AS sql_VAS_committed_gb,
virtual_address_space_available_kb/1024./1024. AS sql_VAS_available_gb,
page_fault_count AS sql_page_fault_count,
memory_utilization_percentage AS sql_memory_utilization_percentage,
process_physical_memory_low AS sql_process_physical_memory_low,
process_virtual_memory_low AS sql_process_virtual_memory_low
FROM sys.dm_os_process_memory;
SELECT TOP 20 [type] AS clerk_type
, SUM((pages_kb + awe_allocated_kb + virtual_memory_committed_kb)/1024./1024.) AS memory_gb
FROM sys.dm_os_memory_clerks
GROUP BY GROUPING SETS (([type]), ())
ORDER BY memory_gb DESC
DBCC MEMORYSTATUS
select
SUM(CAST(is_idle AS tinyint)) AS idle_schedulers_total
, COUNT(*) AS schedulers_total
, SUM(runnable_tasks_count) AS runnable_tasks_total
, SUM(work_queue_count) AS work_queue_total
, SUM(pending_disk_io_count) AS pending_disk_io_total
, SUM(current_tasks_count) AS current_task_total
, SUM(active_workers_count) AS active_workers_total
, SUM(current_workers_count) AS current_workers_total
from sys.dm_os_schedulers
where [status] = 'visible online';
select *
from sys.dm_exec_query_resource_semaphores;
select * from sys.dm_exec_query_memory_grants WHERE queue_id IS NOT NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment