sql server中的工作线程

/*
在SQL SERVER 2005 及以后版本中, 使用'MAXworker thread' 来配置
可用的线程数,默认设置为0 ,即自动控制线程数
 
计算最大工作线程数:
 
对于32 位系统:
逻辑CPU数<= 4 时:max worker threads = 256
逻辑CPU数> 4 时: max worker threads = 256 + (logic cpus's-4)*8
 
对于64 位系统:
逻辑CPU数<= 4 时:max worker threads = 512
逻辑CPU数> 4 时: max worker threads = 512 + (logic cpus's-4)*16
 
*/
 
--================================================================
--查看最大工作线程数
SELECT max_workers_count
FROM sys.dm_os_sys_info
 
--================================================================
--查看使用的工作线程数
SELECT SUM(S.current_workers_count)
FROM sys.dm_os_schedulers S
 
 
/*
--=========================================
镜像使用的线程数:
 
主服务器:需要一个全局线程+每个镜像数据库两个线程
32 位镜像服务器:一个全局线程+每个镜像库十个线程
64 位镜像服务器:一个全局线程+ (2+ (logic_cpu_count %4)) * 镜像数据库数
见证服务器:两个全局线程
 
--=========================================
*/
 
--========================================
--查看等待IO的调度
SELECT S.pending_disk_io_count
FROM sys.dm_os_schedulers S
 
 
--参考:http://support.microsoft.com/kb/2001270

原文地址:https://www.cnblogs.com/gered/p/10600496.html