PREEMPTIVE_OS_CREATEFILE Wait Type in SQL Server

PREEMPTIVE_OS_CREATEFILE is recorded while a thread calls the Windows CreateFile function. The name misleads slightly: CreateFile is Windows’ general-purpose file open API, used for reading existing files as much as creating new ones. Any SQL Server operation that opens a file handle can put time here, with the thread running preemptively (outside SQL Server’s scheduler) until Windows returns.

The workload that makes this wait famous is FILESTREAM, where every stored value is a file and file opens happen at data-access rates.

Is It a Problem?

Modest background amounts, no. It becomes interesting when file-open latency is genuinely hurting a workload, and the causes are almost always beneath SQL Server: SMB shares misbehaving, authentication hiccups on remote paths, a slow or overloaded file system, NTFS cache flushes, or filter drivers (antivirus especially) inspecting every open.

For FILESTREAM workloads, this wait is effectively part of your data access latency, and it deserves the same attention as disk latency would.

Common Causes

  • FILESTREAM access opening files at high frequency.
  • Antivirus or other filter drivers intercepting file opens (FILESTREAM containers are a classic AV-exclusion miss).
  • Slow SMB paths, authentication delays, or DNS issues for files on remote storage.
  • Backup, restore, and database file operations opening handles on slow volumes.

What To Do

  1. Identify the file-touching operations running when the wait accumulates (FILESTREAM access, backups, file-growth events).
  2. Check AV exclusions cover data, log, backup, and FILESTREAM container paths.
  3. For remote paths, test open latency outside SQL Server; if a plain file open is slow from the OS, the fix is infrastructure-side.
  4. For FILESTREAM specifically, review whether frequently accessed small values belong in FILESTREAM at all; in-row storage avoids the file-open cost entirely.

How To See It

Rank it against everything else with Get-WaitStatistics, and correlate with FILESTREAM usage and file operations in the same window.


Part of the SQL Server Wait Types Library.
Related deep dive: SOS_SCHEDULER_YIELD Wait Type.

Comments

Leave a Reply

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