Oracle 5.0 Reference Manual page 1287

Table of Contents

Advertisement

If the transaction isolation level is
within the same transaction read the snapshot established by the first such read in that transaction.
You can get a fresher snapshot for your queries by committing the current transaction and after that
issuing new queries.
With
READ COMMITTED
its own fresh snapshot.
Consistent read is the default mode in which
[1121]
and
COMMITTED
any locks on the tables it accesses, and therefore other sessions are free to modify those tables at the
same time a consistent read is being performed on the table.
Suppose that you are running in the default
a consistent read (that is, an ordinary
according to which your query sees the database. If another transaction deletes a row and commits
after your timepoint was assigned, you do not see the row as having been deleted. Inserts and updates
are treated similarly.
You can advance your timepoint by committing your transaction and then doing another
START TRANSACTION WITH CONSISTENT
This is called multi-versioned concurrency control.
In the following example, session A sees the row inserted by B only when B has committed the insert
and A has committed as well, so that the timepoint is advanced past the commit of B.
Session A
SET autocommit=0;
time
|
SELECT * FROM t;
|
empty set
|
|
v
SELECT * FROM t;
empty set
SELECT * FROM t;
empty set
COMMIT;
SELECT * FROM t;
---------------------
|
1
|
---------------------
1 row in set
If you want to see the "freshest" state of the database, you should use either the
[1121]
isolation level or a locking read:
COMMITTED
SELECT * FROM t LOCK IN SHARE MODE;
With
READ COMMITTED
its own fresh snapshot. With
until the transaction containing the freshest rows ends (see
and
UPDATE
SELECT ... LOCK IN SHARE MODE
Consistent read does not work over
• Consistent read does not work over
dropped and
InnoDB
The
Transaction Model and Locking
InnoDB
REPEATABLE READ
[1121]
isolation level, each consistent read within a transaction sets and reads
InnoDB
[1120]
REPEATABLE READ
REPEATABLE READ
statement),
SELECT
SNAPSHOT.
Session B
SET autocommit=0;
INSERT INTO t VALUES (1, 2);
COMMIT;
2
|
[1121]
isolation level, each consistent read within a transaction sets and reads
LOCK IN SHARE
DROP TABLE
DROP TABLE
destroys the table.
1267
[1120]
(the default level), all consistent reads
processes
SELECT
isolation levels. A consistent read does not set
[1120]
gives your transaction a timepoint
InnoDB
MODE, a locking read occurs instead: A
Section 14.2.7.3,
Locking
Reads").
or over
ALTER
TABLE:
because MySQL cannot use a table that has been
statements in
READ
isolation level. When you issue
SELECT
READ
SELECT
"SELECT ... FOR
or
blocks

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents