Default Locking for INSERT, UPDATE, DELETE, and SELECT ... FOR UPDATE (351)
The locking characteristics of INSERT, UPDATE, DELETE, and SELECT ... FOR UPDATE
statements are as follows:
■ The transaction that contains a DML statement acquires exclusive row locks on the
rows modified by the statement. Other transactions cannot update or delete the
locked rows until the locking transaction either commits or rolls back.
■ The transaction that contains a DML statement does not need to acquire row locks
on any rows selected by a subquery or an implicit query, such as a query in a
WHERE clause. A subquery or implicit query in a DML statement is guaranteed to
be consistent as of the start of the query and does not see the effects of the DML
statement it is part of.
■ A query in a transaction can see the changes made by previous DML statements in
the same transaction, but cannot see the changes of other transactions begun after
its own transaction.
■ In addition to the necessary exclusive row locks, a transaction that contains a DML
statement acquires at least a row exclusive table lock on the table that contains the
affected rows. If the containing transaction already holds a share, share row
exclusive, or exclusive table lock for that table, the row exclusive table lock is not
acquired. If the containing transaction already holds a row share table lock, Oracle
automatically converts this lock to a row exclusive table lock.
NSERT,UPDATE,DELETE,及 SELECT ... FOR UPDATE 語句預設獲取的鎖
有以下特點 :
1. 包含 DML 語句的事務需要獲得被其修改的資料行上的排他行級鎖
2. 事務無需獲取 DML 語句內的子查詢或隱式查詢所選擇的行上的行級鎖
3. 事務內的查詢能夠看到本事務內之前執行的 DML 語句對資料的修改,之後的無法看到
4. 事務內的 DML 語句除了需要獲得必要的排他行級鎖外,至少還需獲得包含被修改資料行的表上
的行排他表級鎖 . 如果事務已經獲得了相關表上的行共享表級鎖 ,Oracle 將自動地將此鎖轉換為行排
他表級鎖.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10599713/viewspace-991301/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SQLite語句(二):INSERT DELETE UPDATE SELECTSQLitedelete
- DBeaver如何生成select,update,delete,insert語句delete
- java-Mybatis XML 對映器(select,insert, update 和 delete)JavaMyBatisXMLdelete
- mysql update join,insert select 語法MySql
- sql server 帶有OUTPUT的INSERT,DELETE,UPDATESQLServerdelete
- KunlunDB功能之insert/update/delete...returning語句delete
- 利用insert,update和delete注入獲取資料delete
- mysql 在delete、insert、update 時,page的變化MySqldelete
- select for update
- 輕量ORM-SqlRepoEx (四)INSERT、UPDATE、DELETE 語句ORMSQLdelete
- SQL Server的Merge —— 一步實現 insert,update,deleteSQLServerdelete
- Laravel5.6 如何列印 SQL?insert/update/select 列印方法總結LaravelSQL
- MySQL insert on duplicate key update 死鎖MySql
- sql查詢更新update selectSQL
- mybatis 批量新增insert、更新update詳解MyBatis
- 深入理解SELECT ... LOCK IN SHARE MODE和SELECT ... FOR UPDATE
- Sqlserver update\delete用inner join關聯,會update\delete關鍵字後面的表關聯到的行SQLServerdelete
- MyBatis(五) insert、update、delete 、主鍵回填、返回matched行數和affected行數、引數配置#{},${}MyBatisdelete
- MySQL資料災難挽救之Delete\UpdateMySqldelete
- BUG: pymysql executemany不支援insert on duplicate key updateMySql
- Oracle中 Update和insert結合語法Oracle
- Sqlserver、oracle中Merge的使用方法,一個merge語句搞定多個Insert,Update,Delete操作SQLServerOracledelete
- mssql sqlserver update delete表別名用法簡介SQLServerdelete
- MySQL 關於 INSERT INTO...ON DUPLICATE KEY UPDATE 的使用MySql
- Oracle中select for update ...一些區別Oracle
- Hive學習筆記 ---- 支援Update和Delete以及MergeHive筆記delete
- 比CRUD多一點兒(三):UPDATE、DELETE語句delete
- MySQL中SELECT+UPDATE併發更新問題MySql
- Thinkphp 3.2.3 parseWhere設計缺陷導致update/delete注入 分析PHPdelete
- 記一次 MySQL select for update 死鎖問題MySql
- Oracle中的for update 和 for update nowaitOracleAI
- ES(Elastic Search)update操作設定無 docment時進行insertAST
- 翻譯:insert on duplicate key update(已提交到MariaDB官方手冊)
- insert into select
- 由select for update鎖等待問題引發的深入思考
- brew update
- 單表的更新UPDATE和刪除記錄DELETE(二十六)delete
- ORACLE RAC叢集大範圍delete大表與insert&update同時執行導致活動會話數飆升Oracledelete會話
- pod update -- Failed to connect to GitHub to update the CocoaPods/Specs specs repoAIGithub