Method for refreshing multicolumn tables in a relational data base using minimal information4631673Abstract A method for refreshing a relational data base snapshot manifest in the form of remote read-only copies of selected portions of a base table. The method takes advantage of the fact that each tuple of the base table has a unique identifier TID associated therewith from the time the record is inserted until it is deleted. The TID references the physical location of the tuple within its relation. Two system-maintained fields are added to the base table. These are PREVTID and update ID. One system-maintained column is required in the snapshot table, i.e. BASE TID. Lastly, a column in the catalog of the snapshot is also maintained, i.e. SNAPHIGH. When the refresh of the snapshot table is required, a single scan of the base relation, in ascending TID sequence, is performed on the base table. The scan produces a series of messages which contain the incremental changes required to update the snapshot table to the current state of the base relation. Upon receipt of the messages at the snapshot table site, a single skip sequential pass across the snapshot in BASE TID sequence is performed to apply the incremental changes. This refreshes the snapshot table to the required state. Claims Having thus described the invention, what is claimed as new and desired to secure the Letters Patent is: Description TECHNICAL FIELD
______________________________________
Reasons for Base Table Updates
______________________________________
SU1.fwdarw.
base table record inserted since last base table refresh
(PREV = null)
SU2.fwdarw.
one or more preceding records deleted since last base
table refresh (PREV = expected PREV)
SU3.fwdarw.
insertion before current record since last base table
refresh (PREV = actual previous)
SU4.fwdarw.
record updated since last base table refresh (PREV =
null & TIME = null)
______________________________________
The following figure describes the initial state of the base table, with records at the indicated address having the indicated values:
______________________________________
Base Table at time TO
addr NAME LOC PREV TIME
______________________________________
10 Bruce SJ -- --
20 Bob NY -- --
30 Laura SJ -- --
40 Mohan NY -- --
______________________________________
Next, let the SINKALL snapshot table be updated at time T1 using the inventive method. The previous refresh time for the SINKALL table will be T0. The following describe (1) the actions and reasons for actions at the base table, and (2) the actions and reasons for actions at the snapshot table. The format of the change record sent to the snapshot table is represented as follows:
__________________________________________________________________________
Xmit(<`values of `normal` fields of snapshot record`>,
base table address of this record,
base table address of previous record in the snapshot table)
__________________________________________________________________________
Refresh of SINKALL
Time of refresh = T1
Last Refresh of SINKALL = T0
Base Table Before Refresh
Base Table After Refresh
addr
NAME LOC
PREV
TIME NAME LOC
PREV
TIME
__________________________________________________________________________
10 Bruce
SJ -- -- .fwdarw. SU1 .fwdarw.
Bruce
SJ 0 T1
TC1 .fwdarw. Xmit(<Bruce,SJ>, 10, 0)
20 Bob NY -- -- .fwdarw. SU1 .fwdarw.
Bob NY 10 T1
TC1 .fwdarw. Xmit(<Bob,NY>, 20, 10)
30 Laura
SJ -- -- .fwdarw. SU1 .fwdarw.
Laura
SJ 20 T1
TC1 .fwdarw. Xmit(<Laura,SJ>, 30, 20)
40 Mohan
NY -- -- .fwdarw. SU1 .fwdarw.
Mohan
NY 30 T1
TC1 & TC3 .fwdarw. Xmit(<Mohan,NY>, 40, 30)
__________________________________________________________________________
SINKALL Before Refresh SINKALL After Refresh
NAME LOC ADDR NAME LOC ADDR
__________________________________________________________________________
Recv(<Bruce,SJ>, 10, 0)
-- -- -- .fwdarw. CS3 .fwdarw.
Bruce SJ 10
Recv(<Bob,NY>, 20, 10)
-- -- -- .fwdarw. CS3 .fwdarw.
Bob NY 20
Recv(<Laura,SJ>, 30, 20)
-- -- -- .fwdarw. CS3 .fwdarw.
Laura SJ 30
Recv(<Mohan,NY>, 40, 30)
-- -- -- .fwdarw. CS3 .fwdarw.
Mohan NY 40
__________________________________________________________________________
Next, let the SINKSJ table be updated using the inventive method. The time of the refresh will be T2 while the time of last refresh for SINKSJ is T0. Note that no updates are made to the base table because there have been no base table updates since the last execution of the refresh method. Note, also, that only records which appear in the restricted SINKSJ are transmitted and that the transmitted "last in snapshot table" value is adjusted accordingly.
__________________________________________________________________________
Refresh of SINKSJ
Time of refresh = T2
Last Refresh of SINKSJ = T0
Base Table Before Refresh
Base Table After Refresh
addr
NAME LOC
PREV
TIME NAME LOC
PREV
TIME
__________________________________________________________________________
10 Bruce
SJ 0 T1 .fwdarw..fwdarw..fwdarw.
Bruce
SJ 0 T1
TC1 .fwdarw. Xmit(<Bruce,SJ>, 10, 0)
20 Bob NY 10 T1 .fwdarw..fwdarw..fwdarw.
Bob NY 10 T1
30 Laura
SJ 20 T1 .fwdarw..fwdarw..fwdarw.
Laura
SJ 20 T1
TC1 .fwdarw. Xmit(<Laura,SJ>, 30, 10)
40 Mohan
NY 30 T1 .fwdarw..fwdarw..fwdarw.
Mohan
NY 30 T1
TC3 .fwdarw. Xmit(.rarw.,.fwdarw., -, 30)
__________________________________________________________________________
SINKSJ Before Refresh SINKSJ After Refresh
NAME LOC ADDR NAME LOC ADDR
__________________________________________________________________________
Recv(<Bruce,SJ>, 10, 0)
-- -- -- .fwdarw. CS3 .fwdarw.
Bruce SJ 10
Recv(<Laura,SJ>, 30, 10)
-- -- -- .fwdarw. CS3 .fwdarw.
Laura SJ 30
Recv(.rarw.,.fwdarw., -, 30)
__________________________________________________________________________
Next, let the base table be updated as follows: Update Bruce at 10 to have LOC=NY Insert George at 15 with LOC=SJ Delete Laura at 30 The contents of the base table will now be as follows:
______________________________________
Base Table at time T3
addr NAME LOC PREV TIME
______________________________________
10 Bruce NY 0 --
15 George SJ -- --
20 Bob NY 10 T1
40 Mohan NY 30 T1
______________________________________
Next, let the SINKALL table be updated at time T3 using the differential refresh method. The previous refresh time for the SINKALL table is T1.
__________________________________________________________________________
Refresh of SINKALL
Time of refresh = T3
Last Refresh of SINKALL = T1
Base Table Before Refresh
Base Table After Refresh
addr
NAME LOC
PREV
TIME NAME LOC
PREV
TIME
__________________________________________________________________________
10 Bruce
NY 0 -- .fwdarw. SU4 .fwdarw.
Bruce
SJ 0 T3
TC1 .fwdarw. Xmit(<Bruce,NY>, 10, 0)
15 George
SJ -- -- .fwdarw. SU1.fwdarw.
George
SJ 10
T3
TC1 .fwdarw. Xmit(<George,SJ>, 15, 10)
20 Bob NY 10 T1 .fwdarw. SU3 .fwdarw.
Bob NY 15
T1
40 Mohan
NY 30 T1 .fwdarw. SU2 .fwdarw.
Mohan
NY 20
T3
TC2 & TC3 .fwdarw. Xmit(<Mohan,NY>, 40, 20)
__________________________________________________________________________
SINKALL Before Refresh SINKALL After Refresh
NAME LOC ADDR NAME LOC ADDR
__________________________________________________________________________
Recv(<Bruce,NY>, 10, 0)
Bruce SJ 10 .fwdarw. CS2 .fwdarw.
Bruce NY 10
Recv(<George,SJ>, 15, 10)
-- -- -- .fwdarw. CS3 .fwdarw.
George
SJ 15
Bob NY 20 .fwdarw..fwdarw..fwdarw.
Bob NY 20
Recv(<Mohan,NY>, 40, 20)
Laura SJ 30 .fwdarw. CS1 .fwdarw.
-- -- --
Mohan NY 40 .fwdarw..fwdarw..fwdarw.
Mohan NY 40
__________________________________________________________________________
Next, let the SINKSJ table be updated using the differential refresh method. The time of the refresh will be T4 while the time of last refresh for SINKSJ is T2.
__________________________________________________________________________
Refresh of SINKSJ
Time of refresh = T4
Last Refresh of SINKSJ = T2
Base Table Before Refresh
Base Table After Refresh
addr
NAME LOC
PREV
TIME NAME LOC
PREV
TIME
__________________________________________________________________________
10 Bruce
NY 0 T3 .fwdarw..fwdarw..fwdarw.
Bruce
NY 0 T3
15 George
SJ 10 T3 .fwdarw..fwdarw..fwdarw.
George
SJ 10 T3
TC1 .fwdarw. Xmit (<George,SJ>, 15, 0)
20 Bob NY 15 T1 .fwdarw..fwdarw..fwdarw.
Bob NY 15 T1
40 Mohan
NY 20 T3 .fwdarw. SU2 .fwdarw.
Mohan
NY 20 T3
TC3 .fwdarw. Xmit(.rarw.,.fwdarw., -, 15)
__________________________________________________________________________
SINKSJ Before Refresh SINKSJ After Refresh
NAME LOC ADDR NAME LOC ADDR
__________________________________________________________________________
Recv(<George,SJ>, 15, 0)
Bruce SJ 10 .fwdarw. CS1 .fwdarw.
-- -- --
-- -- -- .fwdarw. CS3 .fwdarw.
George
SJ 15
Recv(.rarw.,.fwdarw., -, 15)
Laura SJ 30 .fwdarw. CS3 .fwdarw.
-- -- --
__________________________________________________________________________
Next, let the base table be updated as follows: Delete Bruce at 10 Insert Paul at 10 with LOC=SJ Delete Bob at 20 Insert Guy at 17 with LOC=NY Insert Ron at 30 with LOC=SJ The contents of the base table will now be as follows:
______________________________________
Base Table at time T5
addr NAME LOC PREV TIME
______________________________________
10 Paul SJ -- --
15 George SJ 10 T3
17 Guy NY -- --
30 Ron SJ -- --
40 Mohan NY 20 T3
______________________________________
This time let the SINKSJ table be updated first using the differential refresh method. The time of the refresh will be T5 while the time of last refresh for SINKSJ is T4.
__________________________________________________________________________
Refresh of SINKSJ
Time of refresh = T5
Last Refresh of SINKSJ = T4
Base Table Before Refresh
Base Table After Refresh
addr
NAME LOC
PREV
TIME NAME LOC
PREV
TIME
__________________________________________________________________________
10 Paul SJ -- -- .fwdarw. SU1 .fwdarw.
Paul SJ 0 T5
TC1 .fwdarw. Xmit(<Paul,SJ>, 10, 0)
15 George
SJ 10 T3 .fwdarw..fwdarw..fwdarw.
George
SJ 10 T3
17 Guy NY -- -- .fwdarw. SU1 .fwdarw.
Guy NY 15 T5
30 Ron SJ -- -- .fwdarw. SU1 .fwdarw.
Ron SJ 17 T5
TC1 & TC2 .fwdarw. Xmit(<Ron,SJ>, 30, 15)
40 Mohan
NY 20 T3 .fwdarw. SU2 & SU3 .fwdarw.
Mohan
NY 30 T5
TC3 .fwdarw. Xmit(.rarw.,.fwdarw., -, 30)
__________________________________________________________________________
SINKSJ Before Refresh SINKSJ After Refresh
NAME LOC ADDR NAME LOC ADDR
__________________________________________________________________________
Recv(<Paul,SJ>, 10, 0)
-- -- -- .fwdarw. CS3 .fwdarw.
Paul SJ 10
George
SJ 15 .fwdarw..fwdarw..fwdarw.
George
SJ 15
Recv(<Ron,SJ>, 30, 15)
-- -- -- .fwdarw. CS3 .fwdarw.
Ron SJ 30
Recv(.rarw.,.fwdarw., -, 30)
__________________________________________________________________________
Next, let the SINKALL table be updated at time T6 using the differential refresh method. The previous refresh time for the SINKALL table is T3.
__________________________________________________________________________
Refresh of SINKALL
Time of refresh = T6
Last Refresh of SINKALL = T3
Base Table Before Refresh
Base Table After Refresh
addr
NAME LOC
PREV
TIME NAME LOC
PREV
TIME
__________________________________________________________________________
10 Paul SJ 0 T5 .fwdarw..fwdarw..fwdarw.
Paul SJ 0 T5
TC1 .fwdarw. Xmit (<Paul,SJ>, 10, 0)
15 George
SJ 10 T3 .fwdarw..fwdarw..fwdarw.
George
SJ 10 T3
17 Guy NY 15 T5 .fwdarw..fwdarw..fwdarw.
Guy NY 15 T5
TC1 .fwdarw. Xmit(<Guy,NY>, 17, 15)
30 Ron SJ 17 T5 .fwdarw..fwdarw..fwdarw.
Ron SJ 17 T5
TC1 .fwdarw. Xmit(<Ron,SJ>, 30, 17)
40 Mohan
NY 30 T5 .fwdarw..fwdarw..fwdarw.
Mohan
NY 30 T5
TC1 & TC3 .fwdarw. Xmit(<Mohan,NY>, 40, 30)
__________________________________________________________________________
SINKALL Before Refresh SINKALL After Refresh
NAME LOC ADDR NAME LOC ADDR
__________________________________________________________________________
Recv(<Paul,SJ>, 10, 0)
Bruce NY 10 .fwdarw. CS2 .fwdarw.
Paul SJ 10
George
SJ 15 .fwdarw..fwdarw..fwdarw.
George
SJ 15
Recv(<Guy,NY>, 17, 15)
-- -- -- .fwdarw. CS3 .fwdarw.
Guy NY 17
Recv(<Ron,SJ>, 30, 17)
Bob NY 20 .fwdarw. CS1 .fwdarw.
-- -- --
-- -- -- .fwdarw. CS3 .fwdarw.
Ron SJ 30
Recv(<Mohan,NY>, 40, 30)
Mohan NY 40 .fwdarw..fwdarw..fwdarw.
Mohan NY 40
__________________________________________________________________________
Advantages of the Method While the invention is particularly described with reference to a preferred embodiment, it should be appreciated that its departure from the prior art resides in its utilization of only a minimal amount of information in order to refresh the snapshot tables. Further, the method minimizes the number of table changes. Thus, a tuple is transmitted only if the tuple has been updated, inserted, or if the tuple follows one or more deleted tuples in the base table. This has the further consequence of minimizing the amount of logging of changes in addition to reduced message size and change number to the snapshot tables. Yet another aspect of the method is that normal non-refresh actions, on both the snapshot and base tables incur little or no computing resource overhead. That is, for instance, there is no overhead for snapshot read, or for read, insert, or delete on the base table. Likewise, updates on the base table need only write one extra field. This refresh method exploits efficient access paths on the snapshot and base tables during the refresh operation. At the base table, a sequential scan of the relation, i.e. in TID order, can be used to isolate the changes for the snapshot copy. At the snapshot, either a clustered link or clustering index on BASE TID permits access to the needed records of the snapshot during refresh. If the portion of the snapshot to be updated by each refresh is small, a clustered index is advantageous. The method, as described, also suggests the maintenance of multiple snapshot tables, derived from the same source table. The cost of maintenance of the source table control fields is amortized over the multiple dependent snapshots. Updates to the control fields, while refreshing one snapshot, need not be repeated to refresh a second snapshot. Also, the method allows the contents of each snapshot table to be a different subset of the base table.
|
Same subclass Same class Consider this |
||||||||||
