【正文】
? woundwait:如果T1等待T2,僅當T1的時間戳大于T2時,允許T1等待,否則回滾T2n 死鎖檢測和恢復n 超時法 如果等待封鎖的時間超過限時,則撤消該事務n 等待圖法。p 排它鎖(X鎖,eXclusive lock)n 事務T對數(shù)據(jù)對象R加上X鎖,則其它事務對R的任何封鎖請求都不能成功,直至T釋放R上的X鎖;又稱寫鎖n 申請對R的排它鎖:lockX(R)n 一般來說,SQL Server在事務結束時釋放排他鎖。p 共享鎖(S鎖,Share lock)n 事務T對數(shù)據(jù)對象R加上S鎖,則其它事務對R的X鎖請求不能成功,而對R的S鎖請求可以成功;又稱讀鎖n 申請對R的共享鎖: lockS(R)n 用于只讀數(shù)據(jù)操作,它允許多個并發(fā)事務讀取(Select)鎖定資源,但禁止其它事務對鎖定的資源進行修改。n 為了使系統(tǒng)性能良好,應使事務盡量簡短和不受干擾。 鎖v 鎖的作用n 一個事務對某個數(shù)據(jù)對象加鎖,取得對它一定的控制,限制其它事務對該數(shù)據(jù)對象的使用,由此提供事務需要的隔離性,保證各個事務不會互相干擾,一個事務不會讀取或修改另一個事務正在使用的數(shù)據(jù)。216。n 持久性(Durability):事務提交后,對數(shù)據(jù)庫的影響是持久的,即不會因為系統(tǒng)故障影響事務的持久性。n 隔離性(Isolation):一個事務不會干擾另一個事務的進程,事務交叉調度執(zhí)行的結果與串行調度執(zhí)行的結果是一致的。n 一致性(Consistency):事務完成后,所有數(shù)據(jù)處于應有的狀態(tài),所有內部結構正確,能夠準確反映事務所作的工作。 ACID properties of a Transaction(事務的ACID屬性)n 原子性(Atomicity):一個事務中的所有操作要么全部成功,要么全部失敗?! ∪绻侨~(即沒有其他節(jié)點樹),它可以有0到(n 1)之間的值。(n–1)/2249。n/2249。是沖突等價的v B+treeB+tree indices are an alternative to indexedsequential files(B+ 樹索引是連續(xù)索引文件的替換)v Disadvantage of indexedsequential files(順序索引文件的缺點)? performance degrades as file grows, since many overflow blocks get created. (隨著文件的增多,性能會有所下降,因為創(chuàng)建了許多溢出塊) ? Periodic reorganization of entire file is required.(必須定期重組整個文件)v Advantage of B+tree index files(B+tree的優(yōu)點): ? automatically reorganizes itself with small, local, changes, in the face of insertions and deletions.(在進行插入和刪除的時候,能自動對備份和更改進行整理) ? Reorganization of entire file is not required to maintain performance.(對于性能的維護,不需要對整個文件進行重組)v (Minor) disadvantage of B+trees(缺點): extra insertion and deletion overhead, space overhead.(額外的插入和刪除開銷,空間開銷。Applicable when records are sequentially ordered on searchkey適用于記錄順序記錄檢索關鍵字v Multilevel Indexv 沖突可串行化n 沖突指令 當兩條指令是不同事務在相同數(shù)據(jù)項上的操作,并且其中至少有一個是write指令時,則稱這兩條指令是沖突的 如在②、③、④情況下,Ii與Ij 是沖突的 非沖突指令交換次序不會影響調度的最終結果n 沖突等價 如果調度S可以經(jīng)過一系列非沖突指令交換轉換成調度S39。v nonclustering Secondary index: an index whose search key specifies an order different from the sequential order of the file. 索引的檢索關鍵字指定一個順序不同于文件中的順序。v 索引:v Search Key(檢索關鍵字) attribute to set of attributes used to look up records in a file.(設置屬性用于查找在一個文件中的記錄)An index file consists of records (called index entries) of the form(一個索引文件包括記錄表格即索引項表)Index files are typically much smaller than the original file (索引文件比源文件小很多)v Two basic kinds of indices(兩種基本索引):Ordered indices(指令索引): search keys are stored in sorted order(按照順序搜索密鑰存儲)Hash indices(哈希索引): search keys are distributed uniformly across “buckets” using a “hash function”.(檢索關鍵字均勻分布哈希函數(shù)的桶中)v clustering index聚簇索引:Primary index: in a sequentially ordered file,