Can an entity structure lock a table?

I heard that SQL Server is SELECT causing a lock .

So, I have an MVC application with EF and SQL Server 2008, and it shares the database with another application that very often writes some data. And the MVC application generates some real-time reports based on data coming from another application.

So, given that the scenario, is it possible that when creating a report it locks some tables in which another application will try to write data?

I tried to do some manual inserts and updates while creating the report, and it did a great job. Am I misunderstood something?

+4
source share
2 answers

This is one of the reasons why in Entity Framework 6 for Sql Server, the default in database creation has changed :

EF is now aligned with the "best practice" for SQL Server databases, which is to set the READ_COMMITTED_SNAPSHOT database settings to ON. This means that by default, the database will create a snapshot of itself with each change. Requests will be executed in a snapshot while updates will be executed in a real database.

So with the databases created by EF 5 and below, READ_COMMITTED_SNAPSHOTthere is OFF what means that

Database Engine , , .

, :

ALTER DATABASE MyDb SET READ_COMMITTED_SNAPSHOT ON
+3

READ UNCOMMITTED , , . , . SNAPSHOT SELECT. , tempdb.

0

Source: https://habr.com/ru/post/1531188/


All Articles