METADATA_LAZYCACHE_RWLOCK Wait Type in SQL Server

METADATA_LAZYCACHE_RWLOCK is a wait on the reader-writer lock protecting lazily-populated metadata caches, internal caches of object metadata that fill on first use rather than up front. Threads reading a cache while another thread populates or invalidates it queue on this lock.

Version note: this name belongs to older versions; SQL Server 2012 replaced it with MD_LAZYCACHE_RWLOCK, the same mechanism under the newer metadata subsystem’s naming. If you see the old name, you are looking at a 2008 R2-era instance or old captured data.

Is It a Problem?

Rarely; metadata cache locks stay quiet outside metadata churn. The workloads that could theoretically warm it are the metadata-heavy ones: mass object creation and dropping (heavy temp DDL, multi-tenant provisioning), or sweeping metadata queries across enormous catalogs, and even those express themselves through more visible symptoms first.

On any modern instance the practical relevance is recognising the name and its successor.

Common Causes

  • Metadata cache population and invalidation under object churn, on pre-2012 versions.

What To Do

  1. Filter it; and if you are genuinely reading it from a live system, note the version you are on and plan accordingly.
  2. Metadata churn problems, where real, are addressed by reducing the churn (cached temp tables, saner deployment patterns).

How To See It

Rank waits with Get-WaitStatistics; on supported versions, expect its successor’s name, and barely even that.


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 *