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
- java-Mybatis XML 對映器(select,insert, update 和 delete)JavaMyBatisXMLdelete
- 34、VIEW可以insert,delete,update.Viewdelete
- mysql innodb新建索引堵塞update ,insert,deleteMySql索引delete
- 如何插入insert_update,delete_select特殊字元&到oracle表中delete字元Oracle
- mysql update join,insert select 語法MySql
- sql server 帶有OUTPUT的INSERT,DELETE,UPDATESQLServerdelete
- MongoDB入門系列(二):Insert、Update、Delete、DropMongoDBdelete
- 利用insert,update和delete注入獲取資料delete
- mysql 在delete、insert、update 時,page的變化MySqldelete
- MySQL之資料的insert-delete-update操作MySqldelete
- MERGE新特性(UPDATE WHERE,DELETE WHERE,INSERT WHERE)delete
- 模擬insert,update和delete造成阻塞的示例delete
- LINQ to SQL語句之Insert/Update/Delete操作SQLdelete
- Oracle資料庫中Insert、Update、Delete操作速度Oracle資料庫delete
- MySQL 4.1.0 中文參考手冊 --- 6.4 資料操縱:SELECT, INSERT, UPDATE, DELETE (轉)MySqldelete
- KunlunDB功能之insert/update/delete...returning語句delete
- 索引是否也能提高UPDATE,DELETE,INSERT速度 解釋索引delete
- select for update nowait 與 select for update 區別AI
- oracle select for updateOracle
- 輕量ORM-SqlRepoEx (四)INSERT、UPDATE、DELETE 語句ORMSQLdelete
- Delete,insert,update與undo的關係[轉載TOM文章]delete
- 關於 select ... for update 和 for update nowaitAI
- SQL Server的Merge —— 一步實現 insert,update,deleteSQLServerdelete
- SELECT ... FOR UPDATE SKIP LOCKED;
- mysql INSERT ... ON DUPLICATE KEY UPDATEMySql
- 【MyBatis原始碼分析】insert方法、update方法、delete方法處理流程(上篇)MyBatis原始碼delete
- 【MyBatis原始碼分析】insert方法、update方法、delete方法處理流程(下篇)MyBatis原始碼delete
- myisam對於update,insert,delete關於auto_incremant的影響deleteREM
- innodb對於update,insert,delete關於auto_incremant的影響deleteREM
- select for update nowaitAI
- SQL update select語句SQL
- Oracle user1對user2使用者下所有表,有select、insert、delete、update許可權Oracledelete
- 檢視insert,delete,update對基表的影響(檢視初識)delete
- Laravel5.6 如何列印 SQL?insert/update/select 列印方法總結LaravelSQL
- sql查詢更新update selectSQL
- Oracle中select ... for update的用法Oracle
- drop物化檢視log表導致insert、delete、update報ORA-00942delete