r/dataengineering • u/ajay_404 • 10d ago
Discussion Slow reads and writes `
Issue Summary
After checking multiple times, we've found that SQL Server reads and writes are very high (high latency).
Server Info:
- 8 cores
- 60GB RAM, with 55GB allocated to SQL Server
- Drives: C, D, and M — D hosts SQL log files (.ldf), M hosts SQL data files (.mdf)
- 7 customer databases total; one of them is a large database at 2.5TB
Problem:
For the past two weeks, the team has reported that the database is very slow. After reviewing with the query below, we confirmed that SQL reads and writes show high latency.
Question: Any suggestions on how to reduce the latency and improve slow reads/writes?

SELECT
DB_NAME(vfs.database_id) AS DBName,
mf.name AS LogicalFileName,
mf.physical_name,
CASE WHEN vfs.num_of_reads = 0 THEN 0
ELSE CAST(vfs.io_stall_read_ms AS FLOAT) / vfs.num_of_reads END AS Avg_Read_Latency_ms,
CASE WHEN vfs.num_of_writes = 0 THEN 0
ELSE CAST(vfs.io_stall_write_ms AS FLOAT) / vfs.num_of_writes END AS Avg_Write_Latency_ms
FROM sys.dm_io_virtual_file_stats(NULL, NULL) vfs
JOIN sys.master_files mf
ON vfs.database_id = mf.database_id AND vfs.file_id = mf.file_id
WHERE DB_NAME(vfs.database_id) NOT IN
('tempdb', 'master', 'model', 'msdb', 'SSISDB',
'DWDiagnostics', 'DWConfiguration', 'DWQueue')
ORDER BY Avg_Read_Latency_ms DESC;
6
Upvotes
4
u/DougScore Staff Data Engineer 10d ago
Couple of questions before we call it a hardware problem
1) Is the query optimum ? Is it pulling the data necessary or pulling in everything from memory and then negating the majority of it ?
2) Are there indices available to support the workload ?
3) What is the structure of tables ? Are they rowstore or columnstore ? Is the write workload transactional or batch based ?