Select top 1 with UPDLOCK and READPAST sets exclusive lock on the entire table

后端 未结 3 746
感动是毒
感动是毒 2021-01-05 04:44

I\'m using the UPDLOCK and READPAST sql hints in a stored procedure in order to implement a sort of a table queue (I say a sort because I select top 1500 instead of a top 1,

3条回答
  •  无人及你
    2021-01-05 05:24

    Here is how you use tables as queues: SQL Server Process Queue Race Condition

    Summary: you're missing ROWLOCK (which will use more resources in this case)

提交回复
热议问题