In the context of the ACID principles (see also ACID transaction) for database
transactions "Isolation" denotes the idea
that concurrent transactions must not see intermediate (i.e.
uncommitted) results of each other. One could also say that
transactions don't notice any concurrent transactions, i.e. they are
isolated from each other.
In classic database theory isolation is maintained by allowing
only serializable schedules of
transactions. This means that it must be possible to
reorder the actions of all transactions in the schedule in such a
way that a serial schedule with the same effects results. A
schedule is serial if all transactions are executed completely one
after another.
The isolation principle becomes a problem for 'advanced'
database applications like CAD which feature so
called long transactions. Since long transactions
normally take hours or days to complete, guaranteeing
isolation between concurrent transactions is difficult and often not
wanted. If several developers are working at a common model, it may
be advantageous if their transactions are not isolated but the
developers can see each others intermediate results early.
Therefore different grades of isolation were introduced from which
database users should be able to choose:
- degree 0: Chaos
-
Does not overwrite dirty data of other transactions but
provides no other protections. This can be achieved by
setting short exclusive locks
on written (i.e. dirty) data.
-
degree 1: Browse
-
In addition to degree 0 this degree provides protection against
lost updates. This can be achieved by setting
long exclusive locks on written
data. Therefore written data becomes visible only after the
transaction ends.
-
degree 2: Cursor stability
-
In addition to degree 1 this degree does not read dirty data. This
can be achieved by setting short shared
locks on read data. This isolation degree is used by most
commercial RDBMSs.
-
degree 3: Isolated serializable repeatable reads
-
In addition to degree 2 this degree ensures repeatable reads, i.e. other transactions don't overwrite
data read by this transaction. This can be achieved by setting long shared locks on read data.
Degrees 0 and 1 allow to read without setting any locks.
This allows early read access to intermediate results but may lead to
cascading aborts if no further precautions are taken.
The four degrees of isolation are mentioned in the
book Transaction Processing: Concepts & Techniques by Jim
Gray and Andreas Reuter, 1993 and probably elsewhere