Concurrency during continuous upgrade in TSQL

Using Sql Server 2005. I have a lengthy upgrade that can take about 60 seconds in our production environment. This update is not part of any explicit transactions and does not contain any sql hints. While the update is in progress, what can you expect from other queries that occur on the rows that will be updated? The table will update about 6 million complete rows, which will be updated, of which about 500,000 rows will be updated.

Some concurrency problems / questions:

1) What if another query request (with a nolock prompt) is executed in this table among some rows that are being updated. Will the request wait for the update to complete?

2) What in the other query of choice there is no nolock hint? Will this request wait until the update is complete?

3) What if another update request performs an update on one of these lines? Will this request wait until its completion?

4) What about deletions?

5) How about inserts?

Thank! Dave

+3
source share
1 answer

Each SQL Server statement works in a transaction. If you do not explicitly start one, the server starts one for each statement and commits it if the statement is successful, and rolls it back if it is not.

, update, , . , , , , , . , - SQL Server , .

select nolock, , , . , , ( , , ).

, , , ( , ), update.

0

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


All Articles