cơ sở dữ liệu lê thị bảo thu examination sinhvienzone com (1)

4 59 0
cơ sở dữ liệu lê thị bảo thu examination sinhvienzone com (1)

Đang tải... (xem toàn văn)

Thông tin tài liệu

Overview Secondary key(unique value) Number of index entries = Number of record Dense Non-key: 1.duplicate index entries with the same K(i) value keep a list of pointers < P (i, 1), , P (i, k) > in the index entry for K(i) one entry for each distinct index field value + an extra level of indirection to handle the multiple pointers Ordered file: Primary, Clustering Indexing field is Key Primary, Secondary Indexing field is not Key Clustering, Secondary Dense Secondary Nondense all • Multi-Level insertion and deletion of new index entries has problem because ordered file → use tree B-tree: (p ∗ P ) + ((p − 1) ∗ (Pt + V )) ≤ B B + -tree: internal node pleaf /2 TS(T) then abort and roll-back T and reject the operation If write_TS(X) > TS(T), then just ignore the write operation and continue execution because it is already outdated and obsolete •Multiversion Concurrency Control Techniques: A read operation in this mechanism is never rejected more storage (RAM and disk) is required a garbage collection is run A new version of Xi is created only by a write operation • MultiversionTwo-Phase Locking Using Certify Locks Allow a transaction T’ to read a data item X while it is write locked by a conflicting transaction T This is accomplished by maintaining two versions of each data item X: One version must always have been written by some committed transaction This means a write operation always creates a new version of X The second version created when a transaction acquires a write lock an the item read and write operations from conflicting transactions can be processed concurrently may delay transaction commit because of obtaining certify locks on all its writes It avoids cascading abort but like Database Recovery Techniques The flushing is controlled by Modified and Pin-Unpin bits • Data Update Immediate Update As soon as a data item is modified in cache, the disk copy is updated Deferred Update All modified data items in the cache is written either after a transaction ends its execution or after a fixed number of transactions have completed their execution Shadow update The modified version of a data item does not overwrite its disk copy but is written at a separate disk location In-place update The disk version of the data item is overwritten by the cache version • Steal/No-Steal and Force/No-Force Steal: Cache can be flushed before transaction commits No-Steal Cache cannot be flushed before transaction commit Force: Cache is immediately flushed (forced) to disk before the transaction commit No-Force Otherwise Steal/No-Force (Undo/Redo) Steal/Force (Undo/Noredo) No-Steal/No-Force (Redo/No-undo) No-Steal/Force (Noundo/No-redo) • Deferred Update (No Undo/Redo) A set of transactions records their updates in the log At commit point under WAL scheme these updates are saved on database disk After reboot from a failure the log is used to redo all the transactions CuuDuongThanCong.com https://fb.com/tailieudientucntt affected by this failure No undo is required because no AFIM is flushed to the disk before a transaction commits This environment requires some concurrency control mechanism to guarantee isolationproperty of transactions In a system recovery transactions which were recorded in the log after the last checkpoint were redone The recovery manager may scan some of the transactions recorded before the checkpoint to get the AFIMs Active table: All active transactions are entered in this table Commit table: Transactions to be committed are entered in this table During recovery, all transactions of the committable are redone and all transactions of activetables are ignored since none of their AFIMs reached the database • Immediate Update Undo/Redo Algorithm(Single-user environment) Undo of a transaction if it is in the active table Redo of a transaction if it is in the committable Undo/Redo Algorithm(Concurrent execution) To minimize the work of the recovery manager check pointing is used • ARIES Recovery Algorithm Steal/no-force (UNDO/REDO) consists of three steps: Analysis: step identifies the dirty (updated) pages in the buffer and the set of transactions active at the time of crash The appropriate point in the log where redo is to start is also determined Redo: necessary redo operations are applied Undo: log is scanned backwards and the operations of transactions active at the time of crash are undone in reverse order A log record is written for: data update , transaction commit, transaction abort, undo (In the case of undo a compensating log record is written) • The following steps are performed for recovery Analysis phase :Start at the begin_checkpoint record and proceed to the end_checkpoint record end_checkpoint record Access transaction table and dirty page table are appended to the end of the log Modify transaction table and dirty page table: An end log record was encountered for T → delete entry T from transaction table Some other type of log record is encountered for T’ → insert an entry T’ into transaction table if not already The log record corresponds to a change for page P → insert an entry P (if not present) with the associated LSN in dirty page table present, or the last LSN is modified Redo phase: Starts redoing at a point in the log where it knows that previous changes to dirty pages have already been applied to disk Finding the smallest LSN, M of all the dirty pages in the Dirty Page Table A change recorded in the log pertains to the page P that is not in the Dirty Page Table → no redo A change recorded in the log (LSN = N) pertain to Page P and the Dirty Page Table contains an entry for P with LSN > N → no redo Page P is read from disk and the LSN stored on that page > N → no redo CuuDuongThanCong.com https://fb.com/tailieudientucntt ... selection using a composite index: If two or more attributes are involved in equality conditions in the conjunctive condition and a composite index (or hash structure) exists on the combined field,... index: equality comparison, CS6a = x + s (option & 2); CS6a = x + s + (option 3); comparison condition such as >, =,

Ngày đăng: 29/01/2020, 14:40

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan