Locking Issues and Types

  • Hi,

    I got confused as i read lot of documentation about lock type / Locking.

     

     

    54600DB                SGRANT
    54610764071040TAB                ISGRANT
    54610764071041PAG1:4908422       SGRANT
    5461076407104255PAG1:2081187       SGRANT
    when issued delete statement where a select statement is already running on the same table
    5461076407104255PAG1:1263264       SGRANTShared Lock
    54600DB                SGRANTShared Lock
    54610764071040TAB                ISGRANTOn Table Intent Shared Lock
    54610764071041PAG1:4908964       SGRANTShared Lock
    551855753430TAB                ISGRANT
    57610764071041PAG1:4991145       UGRANTUpdate Lock
    57600DB                SGRANTShared Lock
    57610764071040TAB                IXGRANTIntent Exclusive
    5761076407104255PAG1:1754553       XGRANTExclusive Lock

     

    Pls explain  what is going on here as i know

    IS is issued on the table (transaction will read some ) but i issued the command select * from Table name.

    S is issued on pag , DB  because the transaction is reading the data.

    as the above two lock are aready issued on the table then why there is update lock and intent exclusive locks when i try to delete few rows.

    IX the transaction will modify all but not all.

    X Completely lock the resources from anytype of access.

     

    from

    Killer

  • This was removed by the editor as SPAM

  • I'm no expert in locking, but from my limited knowledge the Update lock is the delete statement updating the table as there is no such thing as a delete lock.

    Intent locks are locks that will occur if the lock needs to be escalated, so if the delete lock starts locking more pages there comes a point where it is more efficient for SQL to lock the whole table hence the IX lock on the table.

    The same goes for the Shared locks from the Select statement, at the moment there is currently one a shared lock on a page, the IS on the table indicates that if required SQL while acquire a shared lock on the table.

    For more information lock at locking in the index of books online that explains reseanably well what the process is.

    Andy

Viewing 3 posts - 1 through 2 (of 2 total)

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