Document Type | Technical Information
Category | Administration
Document Number | TADTI073
Overview
This explains through a simple example that reading in Current mode also occurs when the operation involves locking data, such as with the SELECT FOR UPDATE statement, which corresponds to a query.
Method
Executing SELECT FOR UPDATE
SELECT FOR UPDATE is a SELECT statement, but its purpose is to lock and protect the data, so it causes reading in Current mode similar to DML operations.
Below is the result of executing a SELECT FOR UPDATE statement on the emp1 table for the row with employee number 7788.
SQL> set autot on SQL> select * from emp1 where empno = 7788 for update; EMPNO ENAME DEPTNO SAL ------ ----------- ---------- --------- 7788 TIBERO7788 8 7546894 1 row selected.
SQL ID: 3uncmqnwhd2m1
Child number: 124
Plan hash value: 2721807346
Execution Plan
--------------------------------------------------------
1 FOR UPDATE (Cost:3, %%CPU:0, Rows:1)
2 INDEX (UNIQUE SCAN): PK_EMP1_EMPNO (Cost:3, %%CPU:0, Rows:1)
Predicate Information
--------------------------------------------------------
2 - access: ("EMP1"."EMPNO" = 7788) (0.000)
NAME VALUE
------------------- ------
db block gets 2
consistent gets 6
physical reads 0
redo size 158
sorts (disk) 0
sorts (memory) 0
rows processed 1- db block gets = 2 indicates that reading in Current mode occurred.
- This can be interpreted as an action that accessed the actual block to place a lock on the row, not just a simple query.
- consistent gets = 6 refers to normal logical reads (such as Undo-based consistent reads), indicating block access during the SELECT operation.