Information Technology Reference
In-Depth Information
11.1
Secondary-Key-Based Actions
We now assume that our logical database consists of a relation
r.X;Y;V/;
where X is the
primary key
(with unique values as before) and Y is sequence of
attributes (not necessarily with unique values) used as a
secondary key
on which
key-range-read and bulk-delete and bulk-update actions can also be based. Note
that insertions cannot, of course, be performed, but using the primary key can be
The primary-key-based actions now take the following forms:
1. Single-tuple read actions RŒx;
z
;y;
v
for given primary key x
2. Single-tuple insert actions IŒx;y;
v
3. Single-tuple delete actions DŒx; y;
v
for given primary key x
4. Single-tuple write actions WŒx;y;
v
;y
0
;
v
0
for given x, y
0
and
v
0
5. Bulk-read actions R
X
Œs
X
;s
XYV
for given set s
X
of primary-key ranges
6. Bulk-insert actions IŒs
XYV
7. Bulk-delete actions D
X
Œs
X
;s
XYV
for given set s
X
of primary-key ranges
8. Bulk-update actions WŒs
X
;f;s
XYVY
0
V
0
for given set s
X
of primary-key ranges
and function f.Y;V/
Besides these actions we now allow transactions to contain the following
secondary-key-based actions:
(a) Single-tuple read actions RŒx; y;
z
;
v
for given secondary key
z
(b) Bulk-read actions R
Y
Œs
Y
;s
XYV
for given set s
Y
of secondary-key ranges
(c) Bulk-delete actions D
Y
Œs
Y
;s
XYV
for given set s
Y
of secondary-key ranges
(d) Bulk-update (or bulk-write) actions W
Y
Œs
Y
;f;s
XYVV
0
for given set s
Y
of
secondary-key ranges and function f.V/
Here action (a) is only defined for unique secondary keys, and it retrieves the tuple
.x; y;
v
/ with the least key y
z
. Actions (b)-(d) also apply to non-unique keys.
Action (b) returns the set s
XYV
of tuples .x; y;
v
/ with keys y in one of the ranges
in s
Y
, action (c) deletes the tuples .x; y;
v
/ with keys y in one of the ranges in s
Y
and returns the deleted tuples in set s
XYV
, and action (d) replaces each tuple .x; y;
v
/
with key y in one of the ranges in s
Y
by the tuple .x;y;f.
v
// and returns the set
s
XYVV
0
of tuples .x; y;
v
;f.
v
//.
Expanded histories are used to model the interleaved execution of transactions
containing the above secondary-key-based actions besides the primary-key-based
ones. This is done along the lines explained in Sect.
10.1
. The single-tuple actions
generated from actions (c) and (d) are logged in the obvious way with redo-undo
log records and their undo actions with redo-only log records, as usual.
The definitions of the isolation anomalies that can appear in an expanded history
must be extended so as to cover the secondary-key-based actions. For example, dirty
writes can also occur between two secondary-key-based delete or write actions or