LATCH_KP Wait Type in SQL Server

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

Is It a Problem?

Practically never. A LATCH_KP wait means a thread wanted to pin a structure while another thread held it for destruction, which is a narrow window, so expect zero or close to it; it was zero on our SQL Server 2025 lab. Get Wait Statistics does not filter it out, so if it ranks, you will see it.


What It Means

Microsoft describes it as waiting for a KP (keep) latch on a structure that is not a buffer page or a transaction mark latch. Keep is the lightest latch mode: it stops the structure being destroyed while the holder looks at it, and the latch compatibility table shows it compatible with every mode except destroy (DT). This wait type exists mainly so every latch mode has a LATCH_* wait of its own.


When It Does Matter

On its own, it does not. If latch waits matter on your system, work by latch class rather than by mode, because sys.dm_os_latch_stats groups the modes together and the class names the structure:

SELECT
    latch_class,
    waiting_requests_count,
    wait_time_ms,
    max_wait_time_ms
FROM sys.dm_os_latch_stats
WHERE latch_class <> 'BUFFER'
ORDER BY wait_time_ms DESC;

The baseline to monitor is the top class’s wait_time_ms per interval, and the LATCH_EX page has what to do for the classes with a documented cause. It needs VIEW SERVER STATE.


The LATCH Family

Each latch mode has its own wait type, and the mode only says how the latch was asked for. The latch view groups the modes into a single row per class, so whichever of these you landed on, the check is the same.

  • LATCH_KPKeep. Pins the structure so nothing can destroy it; compatible with every mode except DT.Usually noise. This page.
  • LATCH_SHShared. Reading the structure, any number of readers at once, queueing behind a writer.Usually noise
  • LATCH_UPUpdate. About to modify; allows SH and KP alongside it and nothing else.Usually noise
  • LATCH_EXExclusive. Blocks every other reader and writer of the structure.Worth investigating
  • LATCH_DTDestroy. Taken before the structure is torn down.Usually noise
  • LATCH_NLNull. Documented for information only, not supported.Usually noise

Where To Go Next

LATCH_KP is usually zero. 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 *