Information Technology Reference
In-Depth Information
in the rollback of T , the inserted tuple is deleted from the commit-time table, as are
all the versioned tuples created by T deleted from the versioned relation.
For a committed transaction T , the unique timestamp with .T; / in the
commit-time table is denoted by
commit-time
.T /.
Consider a transaction-time database r and let x be a key such that there exists at
least one tuple with key x created by a committed transaction that committed at time
or earlier. Thus, there exist versioned tuples .x; T;
v
/ with
commit-time
.T /
.
Let .x; T;
v
/ be the one among those tuples with the greatest
commit-time
.T /.Then
the tuple .x;
v
/ is called the
committed version
or
snapshot
of the tuple with key x
in r
at time
or
tuple of version
.
We s a y t h a t key x is (1)
deleted at time
, if the committed version of the tuple
with key x at time is .x;
?
/;(2)
present
(or
alive
)
at time
, if the committed
version of the tuple with key x at time is .x;
v
/ with
v
6D?
;and(3)
absent
at time
, if either it is deleted at or there is no versioned tuple with key x.
The
committed version
or
snapshot
of the transaction-time database
at time
(or
database of version
) is the set of tuples .x;
v
/ with keys x present at time .
The
SQL
language for a transaction-time database might include an extension that
allows
historical as of queries
, also called
time-travel queries
,suchas
select
from
r
where
C.X;V /
as of
.
This query is supposed to return the set of tuples .x;
v
/ that satisfy C.x;
v
/ and
are alive at time .
12.2
Read-Only and Update Transactions
We assume two kinds of transactions on a transaction-time database: read-only
transactions and update transactions. A
read-only transaction
is one that contains
only read actions and is specifically declared so, such as with the
SQL
statement
set
transaction read-only
. All other transactions are
update transactions
.
When a read-only transaction T begins, or when it is about to perform its
first read action, it is given a
start timestamp
, denoted by
start-time
.T /.Thestart
timestamp is created by reading the system clock. The start timestamps need not be
unique.
Usually, a read-only transaction T reads from the version of the database at time
start-time
.T /, and these readings are performed without acquiring any locks. Thus,
a read action RŒx;
z
;
v
by T reads from the database of version
start-time
.T / the
tuple .x;
v
/ where x is the least key with x
z
.
Example 12.1
Assume that the transaction-time database contains initially the
versioned tuples .x; T
0
;
u
0
/ and .y; T
0
;
v
0
/ and that the commit-time table contains
the tuple .T
0
;
0
/, indicating that transaction T
0
created the tuples and committed at
time
0
. Consider the read-only transaction
T
1
D
BR
Œx;
u
0
RŒy;
v
0
RŒy;
v
0
C ,