Capture Physical and Logical CPU details and Physical Memory using TSQL


Most of the time we need to capture the potential hardware capacity of the server which hosts SQL Server and below TSQL will help you to do this.

This script pulls the Logical,Physical CPU details and the Physical,Virtual Memory configurations.

SELECT cpu_count AS [Logical CPUs],
(case hyperthread_ratio
when 1 then
‘1’
else
(cpu_count / hyperthread_ratio)
end)AS [Physical CPUs],
hyperthread_ratio
,physical_memory_in_bytes / 1048576 AS ‘mem_MB’
,virtual_memory_in_bytes / 1048576 AS ‘virtual_mem_MB’
FROM sys.dm_os_sys_info

Leave a comment