LATCH_EX is a wait for an exclusive latch on an internal SQL Server structure that is not a data or index page. SQL Server uses latches to protect all kinds of in-memory structures. Everything that is not a buffer page shows up here under LATCH_* rather than PAGELATCH_* or PAGEIOLATCH_*.
On its own the name tells you very little. The useful detail is the latch class, which names the subsystem under contention.
Is It a Problem?
A small amount is normal. It is worth investigating when LATCH_EX climbs into the top of your wait profile, because that means one specific internal structure is a serialisation point for your workload.
Common Causes
ACCESS_METHODS_DATASET_PARENT: large parallel scans, a very common cause on reporting workloads.LOG_MANAGERor related classes: heavy transaction log activity.- Allocation and metadata latches under heavy DDL or temp object churn.
What To Do
- Look at
sys.dm_os_latch_statsand find the latch class with the most wait time. The DMV groups all latch modes together per class, which is the right altitude for analysis anyway. - Target that subsystem. For
ACCESS_METHODS_DATASET_PARENT, review parallelism (MAXDOP, cost threshold) and index the large scans driving it. - Treat the latch class as the real signal, not the generic
LATCH_EXname. - For before/after comparisons, latch stats can be reset with
DBCC SQLPERF ('sys.dm_os_latch_stats', CLEAR);so you measure just your test window.
How To See It
Rank it against everything else with Get-WaitStatistics, then break it down by class in sys.dm_os_latch_stats.
If LATCH_EX is sitting near the top of your wait stats, these are the next places to look.
- The waits that usually matter, ranked, with what each one is telling you.
- PAGELATCH_EX, TempDB Allocation Contention, the closest wait worth investigating when this one is high.
- Performance & Troubleshooting, the scripts and guides for this part of the stack.
Leave a Reply