Summary: Learn how to use xp_instance_regread to query the Windows Registry for hardware details, including VMware PVSCSI parameters, BIOS release dates, and CPU specifications.
Querying Hardware and Registry Details from SQL Server
Ever wonder about the nitty-gritty details of your SQL Server's underlying hardware? While DMVs provide great data, sometimes peeking into the Windows Registry via T-SQL can give you specific environmental insights. Here is how to pull essential hardware information using xp_instance_regread.
1. VMware Storage Driver Parameters (PVSCSI)
For those running SQL Server on VMware, tuning your storage driver settings is critical for high-throughput I/O. You can check the current parameters for your PVSCSI adapter directly:
-- Check PVSCSI driver parameters
EXEC sys.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
N'SYSTEM\CurrentControlSet\services\pvscsi\Parameters\Device',
N'DriverParameter';
Performance Note: For intensive workloads, VMware often recommends setting RequestRingPages=32 and MaxQueueDepth=254. For more details, see the official VMware KB article.
2. Discovering BIOS Release Date
Identifying the BIOS release date is a quick way to determine if a host needs a firmware update to patch stability or security issues. Run this command to pull it from the registry:
-- Retrieve BIOS release date
EXEC sys.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
N'HARDWARE\DESCRIPTION\System\BIOS',
N'BiosReleaseDate';
3. Identifying Processor Details
Understanding exactly which CPU is powering your instance is fundamental for SQL Server licensing and performance tuning. This command grabs the full processor string:
-- Get CPU Model and Speed
EXEC sys.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
N'HARDWARE\DESCRIPTION\System\CentralProcessor\0',
N'ProcessorNameString';
For deep dives into processor selection and its impact on SQL performance, I highly recommend checking out Glenn Berry's blog on Processor Selection.
Found this SQL monitoring script useful? Share it with your DBA team or subscribe for more T-SQL performance tuning guides!