Default table lock hint on SQL Server 2005/2008

前端 未结 2 1389
心在旅途
心在旅途 2021-01-22 21:44

How do you look up a default global table locking hint?


-- Questions

  1. Are there any DMV/DMF (Dynamic Management View/Function) that r
2条回答
  •  一生所求
    2021-01-22 22:12

    There is no global setting. The default is always READ COMMITTED

    It can be changed at

    • session, batch using [SET TRANSACTION ISOLATION LEVEL][]
    • table using table hints
    • database level for snapshot types using ALTER DATABASE ..xxSNAPSHOTxx

    NOLOCK everywhere is utterly misguided And here too:

    • Is the NOLOCK (Sql Server hint) bad practice?
    • When is it appropriate to use NOLOCK?
    • Get rid of those NOLOCK hints…
    • Why using NOLOCK is bad..

    Edit: After comment about query timeout...

    A query with NOLOCK can still consume massive CPU and IO resources. Locking isn't that big an issue. If it is, then another query is taking too long, probably consuming massive CPU and IO resources...

提交回复
热议问题