Understanding Latches\Locks

  • Hi All

    I'm trying to understand Latch\Lock Waits in SQL Server

    If I am seeing waits with a wait type of %latch%

    Does this mean that a process is waiting to place a Latch on a resource or is that a process is waiting on a resource that currently has a latch on it?

    If I am seeing waits with a wait type of %LCK%

    Does this mean that a process is waiting to place a Lock on a resource or is that a process is waiting on a resource that currently has a Lock on it?

    I'm struggling to understand this

    Thanks

  • Latch waits means the process has requested a latch on some structure and is waiting for the latch to be granted

    Lock waits means the process has requested a lock on some structure and is waiting for the lock to be granted

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (8/15/2012)


    Latch waits means the process has requested a latch on some structure and is waiting for the latch to be granted

    Lock waits means the process has requested a lock on some structure and is waiting for the lock to be granted

    Thanks

    The cause of the actual wait could be anything, right? It doesn't mean that something already has a latch on the resource and therefore other processes have to wait to put a latch on the same resource. Is this right?

  • No, it means exactly that.

    Latch waits will be because another process has an incompatible latch already granted (usually, there are other latch waits for other reasons)

    Lock waits will be because another process has an incompatible lock already granted.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (8/15/2012)


    No, it means exactly that.

    Latch waits will be because another process has an incompatible latch already granted (usually, there are other latch waits for other reasons)

    Lock waits will be because another process has an incompatible lock already granted.

    Thanks

    there are other latch waits for other reasons

    Is this where PageIOLatches come in?

  • Mostly, yes.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply