Locks

  • Dear All,

    What might be the issue if I can see more locks when I ran a below query.

    SELECT request_session_id, COUNT (*) num_locks FROM sys.dm_tran_locks GROUP BY request_session_id

    ORDER BY count (*) DESC

    Please advice.

    Thanks and Regards,

    Ravichandra.

  • ravisamigo (11/18/2010)


    What might be the issue if I can see more locks when I ran a below query.

    SELECT request_session_id, COUNT (*) num_locks FROM sys.dm_tran_locks GROUP BY request_session_id

    ORDER BY count (*) DESC

    More locks means several concurrent processes are using sql server. Whenever you run any DML query, they will lock resources(databases/tables/pages/rows) for the duration of the transaction. This also depends on isolation level of the database/query. Locking is an inherent behaviour of all RDBMS and you cannot do away with it. This is required for maintaining ACID property of the database.



    Pradeep Singh

  • ravisamigo (11/18/2010)


    What might be the issue if I can see more locks when I ran a below query.

    More locks than what? Than earlier? Than you believe should be there?

    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 3 posts - 1 through 2 (of 2 total)

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