Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SqlServer Series Notes-Lock

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

In the database

Modify delete add x lock exclusive lock another operation cannot be accessed when the current table is modified

Query s lock shared lock

Debugging another command fails during a transaction rollback

Begin tran

Update student set name='jack' where id=1

Rollback tran

Select * from student with (nolock)

The database itself has a query to see if the current system has a deadlock that will sacrifice one request to satisfy another.

Avoid deadlocks in development:

1 the order of the operation tables in SQL must be as consistent as possible

2. Add with (nolock) to the query sql

3, deadlock caused by too many links (join) using temporary tables

Let an original table join query with temporary table-temporary table-original table 2 join query-temporary table-original 3

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report