数据库管理系统
Contents
The Architecture of DBMS
The components of DBMS core
The process structure of DBMS
Database Access Management
Query Optimization:"Rewrite" the query statements submitted by user first,and then decide the most effective operating method and steps to get the result.The goal is to gain the result of user's query with the lowest cost and in shortest time.(Algebra Optimization;Operation Optimization)
Transaction Management
Recovery
Concurrent Control
File Organization
Heap file: records stored according to their inserted order,and retrieved sequentially.This is the most basic and general form of file organization.
Direct file:the record address is mapped through hash function according to some attribute's value
Indexed file:index+heap file/cluster
Dynamic hashing
Grid structure file
Index Technique(B+Tree; Clustering index....)
Basic principles
The target of algebra optimization is to make the scale of the operands which involved in binary operations be as small as possible
The Operation Optimization
Optimization of (1 select operation 2 project operation 3 set operation 4 join operation 5 combined operation)
Optimization of join operation
Merge scan:order the relation R and S on disk in ahead,then we can compare their tuples in order,and both relation only need to scan one time.If R and S have not ordered in ahead,must consider the ordering cost to see if it is worth to use this method
Using index or hash to look for mapping tuples :in nested loop method,if there is suitable access route on I(say B+tree index),it can be used to substitute sequence scan.It is best when there is cluster index or hash on join attributes.
Recovery
Introduction
The main roles of recovery mechanism in DBMS are:
(1) Reducing the likelihood of failures(prevention)
(2)Recover from failures(solving)
Restore DB to a consistent state after some failures
Redundancy is necessary
Backup+Log
Log:record of all changes on DB since the last backup copy was made
change:1 Old value(before image---B.I)2 New value(after image---A.I) recorded into Log
For update op:B.I A.I
insert op: ----- A.I
delete op.: B.I ---
While recovering:
Some transactions maybe half done,should undo them with B.I recorded in Log
Some transactions have finished but the results have not been written into DB in time,should redo them with A.I recorded in Log(finish writing into DB)
It is possible to recover DB to the most recent consistent state with Log.
Transaction
A transaction T is a finite sequence of actio