PREEMPTIVE_OS_FILEOPS Wait Type in SQL Server

⏳Part of the SQL Server Wait Types Library, every wait type explained.Related deep dive: SOS_SCHEDULER_YIELD Wait TypeRelated pillar: Performance & Troubleshooting

Is It a Problem?

Not in practice; it is not a known contention point. On our SQL Server 2025 lab it had about 6,000 waits and 133 seconds in a day. Get Wait Statistics does not filter it out, so if it ranks, you will see it.


What It Means

Microsoft lists it as internal use only. It is the generic wait for several Windows file system functions, the ones without a preemptive wait of their own. While the call runs, the thread is in preemptive mode, outside SQL Server’s scheduler. It rises around work that touches the file system beyond plain data I/O, such as backups, restores and file creation.


When It Does Matter

When it grows without an obvious scheduled cause. Match it to backup windows and file operations first, then catch the caller:

SELECT
    r.session_id,
    r.wait_type,
    r.wait_time AS wait_ms,
    s.login_name,
    s.program_name,
    t.text AS running_sql
FROM sys.dm_exec_requests AS r
JOIN sys.dm_exec_sessions AS s ON s.session_id = r.session_id
OUTER APPLY sys.dm_exec_sql_text(r.sql_handle) AS t
WHERE r.wait_type LIKE N'PREEMPTIVE_OS_%'
ORDER BY r.wait_time DESC;

If basic file operations are slow from Windows on those volumes, the fix is in the infrastructure; check antivirus exclusions for the data, log and backup paths. The baseline to monitor is its wait time per interval against your backup schedule. The query needs VIEW SERVER STATE.


The PREEMPTIVE_OS File Waits

Each of these is SQL Server calling a Windows file API and waiting for it to return, so the time is spent in the operating system and the storage underneath it. If one is near the top of your waits, read it next to the waits that usually matter.

  • PREEMPTIVE_OS_WRITEFILEGATHERZeroing file space. Writing zeros into new file space when a file is created or grows without instant file initialization.Worth investigating
  • PREEMPTIVE_OS_CREATEFILEOpening files. The Windows CreateFile call, used to open existing files as well as create new ones.Worth a look when it climbs
  • PREEMPTIVE_OS_FLUSHFILEBUFFERSFlushing to disk. Forcing buffered writes for a file down to durable storage.Worth a look when it climbs
  • PREEMPTIVE_OS_FILEOPSOther file calls. A catch-all for Windows file functions without a wait type of their own.Worth a look when it climbs. This page.
  • PREEMPTIVE_OS_GETDISKFREESPACEFree space checks. Asking Windows how much space a volume has, often from monitoring queries.Usually noise
  • File Operation waitsThe rest of the file APIs. The smaller file calls covered together on one page.Worth a look when it climbs

Where To Go Next

PREEMPTIVE_OS_FILEOPS follows file activity. If you are chasing a real problem, start with the waits that cost you time.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *