Why is SQL Server 2008 blocking SELECT's on long transaction INSERT's?

后端 未结 4 1467
花落未央
花落未央 2021-02-02 14:26

We are trying to have a transactional table that only takes new records inserted on a regular basis.

This simple table requires us to continuously add new records to it

4条回答
  •  野的像风
    2021-02-02 14:45

    this locking behavior is a feature of SQL Server. With 2005 and above, you can use row level versioning (which is what is used by default on Oracle) to achieve the same result & not block your selects. This puts extra strain on tempdb because tempdb maintains the row level versioning, so make sure you accommodate for this. To make SQL behave the way you want it to, run this:

    ALTER DATABASE MyDatabase
    SET ALLOW_SNAPSHOT_ISOLATION ON
    
    ALTER DATABASE MyDatabase
    SET READ_COMMITTED_SNAPSHOT ON
    

提交回复
热议问题