LCK_M_SCH_S is a wait to acquire a Schema Stability (SCH-S) lock. Every query takes SCH-S locks on the objects it touches, during compilation and execution, to guarantee the table’s structure does not change underneath it. SCH-S is the most compatible lock in the engine; it coexists with everything except one thing: a Schema Modification (SCH-M) lock.
So this wait has exactly one meaning. Somewhere, DDL is running (or queued) with an SCH-M lock on an object your queries need, and those queries cannot even compile until it clears.
Is It a Problem?
Yes, and it tends to be dramatic when it happens. Because every query needs SCH-S, one long DDL operation can stall an entire application, including queries that would normally run in milliseconds. The classic symptom is “everything on table X froze for two minutes” during a deployment or maintenance window.
Watch for the queue effect: a waiting SCH-M request blocks new SCH-S requests even before the DDL starts doing work, so one ALTER TABLE stuck behind a long-running query can freeze everyone else behind it.
Common Causes
- Offline index rebuilds or
ALTER TABLEoperations during busy periods. - DDL waiting behind a long-running transaction, with everything else then queuing behind the DDL.
- Frequent schema changes from deployment tooling or ORMs that alter objects at runtime.
- Partition switching, which takes SCH-M on both source and target.
What To Do
- Find the SCH-M holder in
sys.dm_tran_locks(request_mode = 'Sch-M') and see what DDL is running. - Move DDL to quiet windows, and use
ONLINE = ONindex operations on Enterprise edition where possible. - Use
WAIT_AT_LOW_PRIORITY(SQL Server 2014 and later) on index operations so DDL yields instead of queuing the world behind it. - Keep user transactions short. DDL blocked behind an idle open transaction is the most common trigger for a pile-up.
How To See It
Rank it against everything else with Get-WaitStatistics. LCK_M_SCH_S spikes are event-driven, so correlate them with your deployment and maintenance schedule.
Part of the SQL Server Wait Types Library.
Related deep dive: LCK_M_X, LCK_M_S, and LCK_M_U Wait Types.
Leave a Reply