1 Fundamental and Application of Database ? o?¨$ ? o?¨$ ??? ??? ? e/ ?D1???ù??? e/ ?D1???ù?? ? ¥t? ¥t 2 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T ?q?q ?T"d?T"d DBMS ?¨"d 7?y ?¨"d 7?y  ?¨"d?¨"d 3 ? 'v ? ? o"d9¥8"2  'v ? ? o"d9¥8"2  ? μ ?)  T¥+?? μ ?)  T¥+? 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 4 ? o¥ ?)  T ?¨ " ?¨ # ?¨ $ ?¨ % ?¨ & ?  T?  T  ?  T?  T  ?  T?  T   T  T =  T =  T ? o ? o ?  T?  T   T?`  T?`  T  T  =  T?` =  T?` 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 5 ? ?)  T ^ ? ¥ ??`)Y ?)  T ^ ? ¥ ??`)Y ? ?  T ¨?  T?  T ¨?  T ?  T ?  T  T ?  T ? =  T i%  T =  T i%  T ? 1  LC ??`aQ¥ ó"?D ? o1  LC ??`aQ¥ ó"?D ? o "d? ?)  T?4  a?^"d? ?)  T?4  a?^ ? ?  T?  T /  T?^  T?^ ?  T  T / =  T?^ =  T?^ 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 6 1.  T  T ? ? o? ?? ? ¥ ? 2?+?¥ í ? o? ?? ? ¥ ? 2?+?¥ í ? ^ ?μ¨?¥ jmb ? ^ ?μ¨?¥ jmb ? ?D 8¥?¨??# P¨¥ú)?? !9 ?D 8¥?¨??# P¨¥ú)?? !9 ?yí1b ? ? ¥ jmYè[ B? ? ?1 ? ¥ jmYè[ B? ? ?1 $b ? ¨  T í ??y  T¨  T í ??y  T DDL í ? ?  ? í ? ?  ?  ¥ jmb ¥ jmb 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 7 2. ?  T?  T ? ^ ? ¨? A?¥ ? jm'D B?¨μ1¥ ^ ? ¨? A?¥ ? jm'D B?¨μ1¥ ? ¥ ? V Ub ? ¥ ? V Ub ? ?  TYè ^  T¥0"?]¨?¥?  T¥ í?  TYè ^  T¥0"?]¨?¥?  T¥ í ? V[?]b ? V[?]b ? ?]¨?¥?  T V[oM-?]B?  T V[?]¨?¥?  T V[oM-?]B?  T V[ 1 B¨?¥??¨ ? P¨B??¨??o ?1 B¨?¥??¨ ? P¨B??¨??o ? P¨B??  Tb P¨B??  Tb ? ¨?  T í ??y¨?  T í ??y (?  T?  T DDL) í ?¨? ? j í ?¨? ? j mb 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 8 3. =  T =  T ? ^ ?  ? o"d =?¥V U' ? ^ ?  ? o"d =?¥V U' ? ¥t ?2?i%Z T¥ í ?b¥t ?2?i%Z T¥ í ?b è ?: c ^ ¨?i%? ^?v è ?: c ^ ¨?i%? ^?v B ?2i ?2i % ^?v% ^?v hashZEi% ì?¥F?ZEi% ì?¥F? Z T ^ I 1 ? ^?a êa ^?F á ?Z T ^ I 1 ? ^?a êa ^?F á ? ¥i%: c2¥???b ¥i%: c2¥???b ? ¨ =  T í ??y¨ =  T í ??y ( =  T =  T DDL) ? í ??? ? í ??? lb 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 9 4. =)?^=)?^ ? ?  T?  T /  T¥?^?l B??  T?  T-  T¥?^?l B??  T?  T- W¥?1"b?  T?M H?  TW¥?1"b?  T?M H?  T /  T¥?  T¥? ^1TM?¥?M[ £?  T ??Mb ^1TM?¥?M[ £?  T ??Mb £  ? ¥ ? ? ??£  ? ¥ ? ? ?? ?  T  T / =  T¥?^?l ? ? 2?i%2 =  T¥?^?l ? ? 2?i%2 -W¥?1"]"? ? o¥i%2-W¥?1"]"? ? o¥i%2 ?M H  T?M H  T / =  T¥?^9A?TM?¥? =  T¥?^9A?TM?¥? ? P¤  T ??Mb £  ? ¥t ?? ?? P¤  T ??Mb £  ? ¥t ?? ? ? 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 10 5. ?)  T¥a? ?)  T¥a? ?  £ ? ¥? ?? £ ? ¥? ?? ? e? ¨?¤ gZL ¨? P¨e? ¨?¤ gZL ¨? P¨ ? μ ?? ?  Zμ ?? ?  Z ? μ ?? ? ? ? áμ ?? ? ? ? á 11 ? 4c ?  1 ?  1 12 ? ? o"d?¥ ? ^? ? o"d?¥ ? ^? %#.4dB5 ?? e?dB5 ?? e? ¥¥ %#.4A?4 ?  1 ? ?[ £ ? A?4 ?  1 ? ?[ £ ? o? ? ¥? ? V L?? ?μrb o? ? ¥? ? V L?? ?μrb ? ?  1 ?  1 ? Y5 ? Y5 ? ? ? o?ˉ ? o?ˉ ? i? e?i? e? ? ???a? ?? e????a? ?? e? 13 4.1 Y¥'à Q Y¥'à Q Ba I 1 ^ Y =a ???l Y ?a Y¥+? 14 Ba I 1 ^ Y Ba I 1 ^ Y ? Y (Transaction) B"  ? o¥°??÷??T?¥?B"  ? o¥°??÷??T?¥? b?t?T1 1 ?S1 1 ??S ^B? ? Vsé¥yT?ê? Vsé¥yT?ê ? è0 ? Y??? ^ ?à Q Y??? ^ ?à Q ? 1" ? o?B? Y V[ ^BH1" ? o?B? Y V[ ^BH SQL? ?  BF SQL? ????? ???? ? B??¨??Yèc? YB??¨??Yèc? Y ? Y ^?ˉ?i? e?¥'?ê Y ^?ˉ?i? e?¥'?ê 15 =a ???l Y =a ???l Y ? A T?lZ T BEGIN TRANSACTION BEGIN TRANSACTION SQL ? ?  1 SQL ? ?  1 SQL ? ?  2 SQL ? ?  2 bbbbb bbbbb COMMIT ROLLBACK ? ? TZ T? TZ T ?¨? àμA T1?l Y H DBMS? ? 8??1??s Y? ? 8??1??s Y 16 Y2 ? Y2 ? COMMIT Y?è2 ? Y?è2 ? 4?4? Y¥ ?μ?T Y¥ ?μ?T  +÷?  Y? ?μ ? o¥÷? Y? ?μ ? o¥÷? ¥ò¥ò 3r ROLLBACK Ysè?? Ysè?? ? Y?¥V??? 3 #p? ???3? Y?¥V??? 3 #p? ???3? íO Y¥ ?μíO Y¥ ?μ ÷? ?T?T ? YOí? YOí? 7 S 7 S H¥ ? H¥ ? 17 ?a Y¥+? ?a Y¥+? (ACID+? +? ) Y¥ Y¥ ACID+? ? e0? Atomicity ? Bá? Consistency ? ? ?? Isolation ? ??? Durability  18 1. e0? e0? ? Y ^ ? o¥ ? yT?ê Y ^ ? o¥ ? yT?ê ? Y? ?¥í?T1 1?S1 1??S Y? ?¥í?T1 1?S1 1??S 19 2. Bá? Bá? Y3?¥2TA? ^ P ? oVB? Y3?¥2TA? ^ P ? oVB? Bá? ?M? 6B?Bá? ?Bá? ?M? 6B?Bá? ? Bá? ?Bá? ?  ? o?oc?? Y4?¥2T ? o?oc?? Y4?¥2T ?Bá ??Bá ?  ? o?c >? Y¥2T ? o?c >? Y¥2T 20 BB á?De0?á?De0? ?kVk|?kVk| A? |B£íi ?k|? |B£íi ?k| Bb ? ?lB? Y? Y ? ??T?lB? Y? Y ? ??T ? ? ??T1 1 ?S1 1 ??S? ??T1 1 ?S1 1 ??S ? ?S? ??S ? o?)?Bá? ?b ?S? ??S ? o?)?Bá? ?b ? ?ToSB??T ? oü)??Bá? ?ToSB??T ? oü)??Bá? ? ? b B=B+1 A=A-1 BA 21 3. ? ?? ? ?? i?3?7yi?3?7y B? Y¥3?? ?$  e Y? ?B? Y¥3?? ?$  e Y? ? ? B? Y =?¥?T# P¨¥ ?   ei?B? Y =?¥?T# P¨¥ ?   ei? Y ^? ?¥ Y ^? ?¥ ? i?3?¥ò? Y-W? ?oM? ?i?3?¥ò? Y-W? ?oM? ? 22 T1¥??$¥??$ T2-? -?   A=16 AoA-3 í A=13 ? A=16 ? è AoA-1 í A=15 é T 2 T 1 23 4. ??? ??? ? ???9?¥ò? ???9?¥ò? Permanence ? B? YB?4? ? ? o? ? ¥?B? YB?4? ? ? o? ? ¥? Mü?? ^¥ò?¥bMü?? ^¥ò?¥b ? ¤/ ?¥  e?T#p???¤/ ?¥  e?T#p???  3? 3? 22 Tμ ???YbTμ ???Yb 24 Y¥+? Y¥+? ?  £ Y £ Y ACID+? ^ Y) ?¥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??"d¥?è?l ?$ ?ê??"d¥?è?l ?$ ?ê ? ?μ??¥ Y?d?è?? ?μ??¥ Y?d?è?? ? =i? ? o? u¥? ??é > =i? ? o? u¥? ??é > ? ??i% !! ¥ ? ? s?Y??i% !! ¥ ? ? s?Y 31 "d#p¥èney "d#p¥èney ? ?T"d?T"d DBMS} ?p} ?p ? ?T??T >?T??T > ? +? ??¥?qp ?+? ??¥?qp ? CPU#p#p ? l ?Tèl ?Tè 32 "d#p¥?ˉ "d#p¥?ˉ ? b" ???¥ Y ? o¥ ?μ?? b" ???¥ Y ? o¥ ?μ?? ? "d ×? ? H×? ? H ?ˉ??1 <?üh?ˉ??1 <?üh  UNDO ?μ??? Y ?μ??? Y ? |? u?X?? Y4?¥2T ? ? o|? u?X?? Y4?¥2T ? ? o ? "d ×? ? H×? ? H ?ˉ??31×S?ˉ??31×S  REDO ?μX4?¥ Y ?μX4?¥ Y 33 ?aoé#p ?aoé#p ? ?q#p Pi%?i?¥ ? ?sé?q#p Pi%?i?¥ ? ?sé > ??é > > ??é > ? oé#p1 -  ?#p¥ V ??l¤oé#p1 -  ?#p¥ V ??l¤ ? ?ê?v¤? ?ê?v¤ 34 oé#p¥èney oé#p¥èney ? ?q#p?q#p ? H ? ?êH ? ?ê ? Hh ·Hh · ? ?T"d¥ ? .p?T"d¥ ? .p ? § H <H?? ? § H <H?? ? 35 oé#p¥?ˉ oé#p¥?ˉ ?  ? ? ? o? 3oé#p - ? H Y¥ ? o? 3oé#p - ? H Y¥ ? ? ?'?' ? ×S1N H S¥ ?μ×S1N H S¥ ?μ ?? Y?? Y |?t YX4?¥2T×?: ? ? o YX4?¥2T×?: ? ? o 36 ?ˉ?T¥'e ? ?ˉ?T¥'e ? ? ?ˉ?T¥'e ??ˉ?T¥'e ? o? ? ?¨ i%"d  ?1Z¥i%"d  ?1Z¥ o? ? ? ? ×y×y ? o?X$ ?ê?? ?¥ *?s ? ? o?X$ ?ê?? ?¥ *?s ? ? ?ˉ¥ LC/ ?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b ? DBA??? ? o P¨ f ? ?? a?¥%? ù???? ? o P¨ f ? ?? a?¥%? ù? %ZEb%ZEb è ? ??? é?? ?9 % ??? é?? ?9 % ? ??é?BQ? ?Z % ??é?BQ? ?Z % ? ?é?BQá ?Z % ?é?BQá ?Z % 51 4.2.3 °?óq °?óq Ba °?óq¥ = ?Ba °?óq¥ = ? =a °?óq¥¨o=a °?óq¥¨o ?a¨: °?óq¥e5 ?a¨: °?óq¥e5 52 Ba °?óq¥ = ? Ba °?óq¥ = ? 1. I 1 ^ °?óq I 1 ^ °?óq °?óq °?óq (log) ^¨ ?: c Y ? o¥ ^¨ ?: c Y ? o¥ ÷??T¥óq÷??T¥óq 2. °?óq¥ì T °?óq¥ì T [: c1?ê¥ °?óq[: c1?ê¥ °?óq [ ? v1?ê¥ °?óq[ ? v1?ê¥ °?óq 53 °?óq¥ = ? ? °?óq¥ = ? ? 3. °?óq = ? °?óq = ? ? ò? Y¥ 7 SS:ò? Y¥ 7 SS: (BEGIN TRANSACTION) ? ò? Y¥2 ?S:ò? Y¥2 ?S: (COMMIT ROLLBACK) ? ò? Y¥ ?μ÷??Tò? Y¥ ?μ÷??T ? DD Yμ1¥ =?÷??T Yμ1¥ =?÷??T °?óq?¥B? °?: c °?óq?¥B? °?: c (log record) 54 4. ?: c¥ °?óq?: c¥ °?óq ?H °?: c¥ = ? ?H °?: c¥ = ? ? YS M YS M ? ?T ?? ? ?a ÷"???T ?? ? ?a ÷"?? ? ?T` : c?T` : c IDaBlock NO. ? ÷? - ? ¥?′ ? ??T7yN[1 b′÷? - ? ¥?′ ? ??T7yN[1 b′ ? ÷?a ? ¥?′  ÷"?T7y÷?a ? ¥?′  ÷"?T7y , N[1 b′ 55 5. ? ? v¥ °?óq? ? v¥ °?óq ?H °?: c¥ = ? ?H °?: c¥ = ? ? YS M S ü ^ *? Y YS M S ü ^ *? Y ? ?T` : c?T` : c IDaBlock NO. ? ÷? - ? ?¥?? ? v¥′ ? ?÷? - ? ?¥?? ? v¥′ ? ? ?T7yN[1 b′ ? ÷?a?? ? v¥′  ÷"?T7y÷?a?? ? v¥′  ÷"?T7y , N[1 b′ 56 =a °?óq¥¨o =a °?óq¥¨o 1¨o¨o ? é? Y#p?ˉé? Y#p?ˉ ? é?"d#p?ˉé?"d#p?ˉ ? xùa!?'é?oé#p?ˉxùa!?'é?oé#p?ˉ 57 °?óq¥¨o ? °?óq¥¨o ? 2Dá ?%a!?' ¥?é?oé#p?ˉDá ?%a!?' ¥?é?oé#p?ˉ ? á ?%¥ ? X ^Bá?¥ ? á ?%¥ ? X ^Bá?¥ ? ? ?Tá ?%??a ˉ ?? ù% °?ó ?Tá ?%??a ˉ ?? ù% °?ó q5Coé#p× ? ?'a V[q5Coé#p× ? ?'a V[ ?¨?t °?óq?'X??¥ Yé?× ?¨?t °?óq?'X??¥ Yé?× S) ?S) ? ? ?"?A×?? *tX??¥ Y??ü V?"?A×?? *tX??¥ Y??ü V ü ? o?ˉ?#p - B H Y¥? ? ?ü ? o?ˉ?#p - B H Y¥? ? ? 58 °?óq¥¨o ? °?óq¥¨o ? #p? 3? á ?% ? Y ? ?è? aaaaaaaaa aaaaaaaaaa 5B 5C5G ¨: °?óq ?aaaaaaaaaaa  aa × a!?' ?¨ °?óq?ˉ Y ??? oé#p?ˉ aaaaaaaaa a aaaaaa ¨: °?óq ?aaaaaa 59 °?óq¥¨o ? °?óq¥¨o ? 3 oé#p?ˉoé#p?ˉ LOG FILE + ? ?%a!?'? ?%a!?' ? ? ?% ? o] H%]B H?¥ °?óq? ?% ? o] H%]B H?¥ °?óq ? a!?'D? °?óq2?  ?? ?| ? o?ˉa!?'D? °?óq2?  ?? ?| ? o?ˉ ?Bá? ?b ? ?¨?t °?óq?'éB??ˉ YE ?×? ?¨?t °?óq?'éB??ˉ YE ?×? ? Y??b 60 ?a¨: °?óq¥e5 ?a¨: °?óq¥e5 ? 1 £ ? o ^ V?ˉ¥¨: °?óq HA1 £ ? o ^ V?ˉ¥¨: °?óq HA ?N? He5?N? He5 ? ¨:¥Q??ì?i? Y3?¥ HWQ?¨:¥Q??ì?i? Y3?¥ HWQ? ? A?5 °?óqa ? oA?5 °?óqa ? o ?  °?óq?TüV U????¥ °?: c °?óq?TüV U????¥ °?: c ? °?óq? °?óq ?  ? o?Tü ? ¥??? ? o? ? o?Tü ? ¥??? ? o? 61 ¨: °?óq¥e5 ? ¨: °?óq¥e5 ? ? 1 I 115 °?óq ?  ? o? °?óq ^ ??]¥?T ? o? °?óq ^ ??]¥?T ? ? ??T-W V ?? 3#p? ??T-W V ?? 3#p ? ?T5  ? o??7 °?óq? àμ¨: ?T5  ? o??7 °?óq? àμ¨: /????5[aüíE?ˉ???? /????5[aüíE?ˉ????  ? ?T5 °?? àμ?? ? o? °?óq? ?T5 °?? àμ?? ? o? °?óq? ˉ Ho?V ^3?BQ?A1¥ˉ Ho?V ^3?BQ?A1¥ UNDO?Ti?Ti ???Y ? o¥? ?????Y ? o¥? ?? 62 4.2.4 ?ˉV? ?ˉV? Y#p¥?ˉ Y#p¥?ˉ "d#p¥?ˉ"d#p¥?ˉ oé#p¥?ˉoé#p¥?ˉ 63 Y#p¥?ˉ Y#p¥?ˉ ? Y#p Y?à?è??? -$?? Y#p Y?à?è??? -$?? ? ?ˉZE?ˉZE ? ??ˉ0"d? ?¨ °?óqüh??ˉ0"d? ?¨ °?óqüh  UNDO N YX ? oé?¥??N YX ? oé?¥?? ? Y#p¥?ˉ?"d1????31¨? Y#p¥?ˉ?"d1????31¨? ?? 64 Y#p¥?ˉ?? Y#p¥?ˉ?? 1. Q_ á íóq °? 'VKa_ - á í °?óqQ_ á íóq °? 'VKa_ - á í °?óq °s? Y¥÷??Tb°s? Y¥÷??Tb 2. ? Y¥÷??T3? I?Tb'| °?: c?? Y¥÷??T3? I?Tb'| °?: c? “÷÷ ? -¥′? -¥′ ” Befor Image, BI  ? ? ob ? ? ??T? ??T “÷? -¥′÷? -¥′ ”1 b5M??S ÷"?T ? ÷"?T ÷"?T “÷?a¥′÷?a¥′ ”1 b5M??S? ??T ? ? ^???T5¨ ? ^???T5¨ BI }9}9 AI After Image 65 Y#p¥?ˉ?? Y#p¥?ˉ?? 3. ??Q_ á í °?óq°s? Y¥??Q_ á í °?óq°s? Y¥  e÷??TiS]") ?b  e÷??TiS]") ?b 4. ?N) ?/ ?°à?N Y¥ 7 S ?N) ?/ ?°à?N Y¥ 7 S S: Y#p?ˉü?? bS: Y#p?ˉü?? b 66 "d#p¥?ˉ "d#p¥?ˉ ? "d#p/? ? o?Bá ?¥ey"d#p/? ? o?Bá ?¥ey ? Bt??? Y ? o¥÷?X ? ? oBt??? Y ? o¥÷?X ? ? o ? BtX4? Y ? o¥÷?? =? uBtX4? Y ? o¥÷?? =? u à ?¤# ? ? o à ?¤# ? ? o ? ?ˉZE?ˉZE ? 1. Undo #p? 3 H???¥ Y#p? 3 H???¥ Y ? 2. Redo X??¥ YX??¥ Y ? "d#p¥?ˉ?"d"d#p¥?ˉ?"d ×? ? H×? ? H 1???1??? ?31¨??? 67 "d#p?ˉ "d#p?ˉ ?? ?? 1.?_ á í °?óq 'Vh á í °?óq?_ á í °?óq 'Vh á í °?óq ? Redo   : #p? 3 -Xü4?¥ Y#p? 3 -Xü4?¥ Y T1, T3, T8….. ? Undo   :#p? 3 H ???¥ Y#p? 3 H ???¥ Y T2, T4, T5, T6, T7, T9 …... 68 "d#p¥?ˉ?? "d#p¥?ˉ?? 2.  Undo   Yé? UNDO) ?) ? Q_ á í °?óq ??Q_ á í °?óq ?? UNDO Y¥÷ Y¥÷ ??T3? I?T??T3? I?T T2, T4, T5, T6, T7, T9 …… 3.  Redo  Yé?  Yé? REDO) ?) ? ?_ á í °?óq ???_ á í °?óq ?? REDO Y×? 3?¨:¥?T3?¨:¥?T T1, T3, T8….. 69 oé#p¥?ˉ oé#p¥?ˉ 1. × ? o× ? o P ? o?ˉ?Bá? ? P ? o?ˉ?Bá? ? 2. ×SX??¥ Y×SX??¥ Y 70 oé#p¥?ˉ oé#p¥?ˉ ? ?ˉ?? 1.  ?K?¥a! ? o?' P ? o?ˉ? ?K?¥a! ? o?' P ? o?ˉ? KíBQ% H¥Bá? ?bKíBQ% H¥Bá? ?b ? ?á ?%¥ ? o?' ?a ? o?á ?%¥ ? o?' ?a ? o ')?Bá? ?')?Bá? ? ? ?? ?%¥ ? o?'??] H ??? ?%¥ ? o?'??] H ? % H Y¥ °?óq?' ?¨D?ˉ"d% H Y¥ °?óq?' ?¨D?ˉ"d #pM]¥ZE '#pM]¥ZE ' REDO+UNDO ?? ?| ? o?ˉ?Bá? ?b ?| ? o?ˉ?Bá? ?b 71 ?¨á ?%?' ?¨á ?%?' | ? o?ˉ?Bá? ?| ? o?ˉ?Bá? ? #p? 3? á ?% ? Y ? ?è? aaaaaaaaaa aaaaaaaaaaa 5B 5C 5G ¨: °?óq ?aaaaaaaaaaaaa × a!?' ?ˉ ?????? 72 ?¨? ?%?' ?¨? ?%?' | ? o?ˉ?Bá? ?| ? o?ˉ?Bá? ? 5B 5C 5G ? ?% ? Y #p? 3? ?è? aaaaaaaaaa aaaaaaaaaaa ¨: °?óq ¨:? °?óq aaaaaaaaaaa aaaaaaaaaaa ↑ % °?óq × a!?' ?a ?¨%¥ °?óq?ˉ ?ˉ?B ?????? á? ? 73 oé#p¥?ˉ ? oé#p¥?ˉ ? 2.  ?μ1¥ °?óq?'×SX??¥ Yb ?μ1¥ °?óq?'×SX??¥ Yb ? n5 á í °?óqs#p? 3 HX4?¥ n5 á í °?óqs#p? 3 HX4?¥ Y¥S M| : ?×S b Y¥S M| : ?×S b ? ?a?_ á í °?óq×S ?¥ ?μ ?a?_ á í °?óq×S ?¥ ?μ Yé?×S) ?b'| °?: c? Yé?×S) ?b'| °?: c? “÷?a÷?a ¥′¥′ ” ? ? ob 74 oé#p¥?ˉ ? oé#p¥?ˉ ? oé#p¥?ˉ31oé#p¥?ˉ31 DBAo ? ? DBA¥yT¥yT ? × Kí%¥ ? o?'?μ1¥ò °?× Kí%¥ ? o?'?μ1¥ò °? óq?'óq?' ? 3?"d4¥?ˉ  73?"d4¥?ˉ  7 ? 8¥?ˉ?T ˉ? 8¥?ˉ?T ˉ? DBMS???? 75 i? e? i? e? i? e?à ?i? e?à ?  í í  íxp íxp  í? μ í í? μ í i??¥ V1??i??¥ V1??  íxp  íxp  í¥ ì í¥ ì 76 i? e?à ?i? e?à ?  Y3?Z T Y3?Z T (1) Y1?3? ? ?? H YoμB? Y?  e Y? Y  e Y A????? Y2 ?[aZ ?2 ?[aZ ? ? ? ? ? s ?¨"d'÷?è ? od' ? o  Z'÷¥+? Z'÷¥+? 77 i? e? ? i? e? ? (2) ?-i?Z T interleaved concurrency ? Y¥i?3? ^?ti? Y¥i??T Y¥i?3? ^?ti? Y¥i??T } @?-? } @?-? ? ^?) ?"d?¥i?Z T ?h ) ^?) ?"d?¥i?Z T ?h ) ?¥ b= HW4ú"d¥r q ?¥ b= HW4ú"d¥r q 78 i? e? ? i? e? ? (3) ] Hi?Z T simultaneous concurrency ? ) ?"d? ??) ? V[?B?) ?"d? ??) ? V[?B? Y?) ? V[] H?? Y Y?) ? V[] H?? Y LC? Y??¥i?? LC? Y??¥i?? ? K ?X¥i?Z T? s???qìaK ?X¥i?Z T? s???qìa ? ÷ˉ¥÷ˉ¥ i?Z T?i?Z T? 79 Yi?3?{ ?¥ù5 Yi?3?{ ?¥ù5 ? V ??i |?i%?? ?¥ ?  ?ê V ??i |?i%?? ?¥ ?  ?ê Y¥? ??? ? o¥Bá? Y¥? ??? ? o¥Bá? ? DBMSA?4i? e??A?4i? e?? ? i? e?? ^? B?i? e?? ^? B? DBMS? ?¥ ×1S?-B×1S?-B 80 i? e?à ? i? e?à ? ? i? e??¥ ?i? e??¥ ? ? i??Té?? ??i??Té?? ?? ?  £ Y¥? ?? £ Y¥? ?? ?  £ ? o¥Bá? £ ? o¥Bá? 81 T1¥??$¥??$ T2-? -?   A=16 AoA-3 í A=13 ? A=16 ? è AoA-1 í A=15 é Y T 2 Y T 1 ? ?Bá L èfè D"d 82 i??T{ ?¥ ? ?Bá?i??T{ ?¥ ? ?Bá? ? é >?? lost update ? ? V×ˉ ? V×ˉ non-repeatable read ?  “## ” ?  ?  dirty read 83 4.3.1  í  í Ba I 1 ^ í =a' í ??=a' í ?? ?a' í¥M ? ? ?a' í¥M ? ? 84 Ba I 1 ^ í Ba I 1 ^ í ?  íü ^ Y íü ^ Y T ? ? ` è ?Va ? ? ` è ?Va : c??T- -5_"d? h p : c??T- -5_"d? h p  F íF í ? F ía YF ía Y Tü? ? `μ B?¥ eü? ? `μ B?¥ e ? Y? Y T db ?¥ í- -  ?¥ Y? db ?¥ í- -  ?¥ Y? ?÷?N ? `b ?÷?N ? `b ?  í ^ LCi? e?¥B?dè×1¥/ ? í ^ LCi? e?¥B?dè×1¥/ ? 85 =a' í ?? =a' í ?? ? DBMSYè4 ? ??¥ íbB? YYè4 ? ??¥ íbB? Y  ? ? `F ía?è?μ I 1"¥ e? ? ? `F ía?è?μ I 1"¥ e? ^? í¥ ?? %?¥b ^? í¥ ?? %?¥b ? ' í ??' í ?? ? ? ? í ? ? í eXclusive lock e:1 X í ?  Z í Share lock e:1 S í 86 ? ? í ? ? í ? ? ? í??1 í ? ? í??1 í ? ? Y ? Y T ? ` ? ` AF F  X í5o ? T |??? |??? A  ? ?? Y?? ?  ? ?? Y?? ?  AF ?? ??¥ í°?F ?? ??¥ í°? T db A   ¥ í¥ í 87  Z í Z í ?  Z í??1 í Z í??1 í ? ? Y ? Y T ? ` ? ` AF F  S í5  ? í5  ? Yo ? AFF S í7? ?F í7? ?F X í °?°? T db A ¥ ¥ S í í 88 ?a í¥M ? ? ?a í¥M ? ? Y=YesM ?¥ h p N=No?M ?¥ h p T 1 T 2 X S - X N N Y S N Y Y - Y Y Y 89 4.3.2  íxp  íxp ? ¨¨ X í? í? S í ? `F í H31? í ? `F í H31? ?Bt?5 íxp Locking Protocol ? ? H # h? H # h X í í S í í ? ? í HWa? H db? í HWa? H db ? ?]¥ íxp?]¥ íxp ?]¥? ?]¥?  1i?? T¥? ??4B?¥ £T¥? ??4B?¥ £ 90 μ íù5 μ íù5 ?  í/ ? V[μr13 %i??T¥B í/ ? V[μr13 %i??T¥B á?ù5?9{ ?Bt?¥ù5 ? μ í μ í ?  í í 91 3 % μ í¥ZE 3 % μ í¥ZE  ?ZE  ?ZE 1. ?] μ í 2. μ í¥?D3" μ í¥?D3" 92 1. μ í¥?] μ í¥?] ? á 3 μ í¥ey ^ ?? Y?Xá 3 μ í¥ey ^ ?? Y?X  í Bt ? ` ?a?? h p í Bt ? ` ?a?? h p X1  e Y í¥ ? `F íVX1  e Y í¥ ? `F íV 7C μ??b ? ?] μ í¥? 3ü ^1 ?êá 3 μ í¥?] μ í¥? 3ü ^1 ?êá 3 μ í¥ HqHq 93 μ í¥?] μ í¥?]  ?  ? ?] μ í¥ZE ?] μ í¥ZE ? BQ íEBQ íE ? ¨? íE ¨? íE 94   1BQ íE BQ íE ? 1 p ?? YA?BQ| ?μ1 P¨¥ ? ?1 p ?? YA?BQ| ?μ1 P¨¥ ? ? ?F í?5ü? ???3??F í?5ü? ???3? ? BQ íEi¥ù5??i?BQ íEi¥ù5??i? ? ?v íS? ?v íS? ? |[a1¨?¥ ?? ? F í ]A ?v|[a1¨?¥ ?? ? F í ]A ?v  í¥S?V7?? "d¥i?  í¥S?V7?? "d¥i? 95 BQ íE ? BQ íE ? ? 4? Y5ú ? ?? í` 4? Y5ú ? ?? í` ? ? o? ? ^?M?¥e ?? ? o? ? ^?M?¥e ?? 1 p í¥ ? 3?V?? V ?1 p í¥ ? 3?V?? V ? ?M? í` ?[? 4 Y5ú ??M? í` ?[? 4 Y5ú ? 1 ?? ?? Y ?1 í¥ ? `1 ?? ?? Y ?1 í¥ ? ` ? 3 %ZE| Y3?V?? V ?3 %ZE| Y3?V?? V ? 1 í¥ ? ` ??F í?üé1 í¥ ? ` ??F í?üé B??? i?B??? i? b 96   2 ¨? íE  ¨? íE ? ¨? íE ^?5 ? `??B? í ¨ ¨? íE ^?5 ? `??B? í ¨ ? ?μ Y???? ¨? L? íb? ?μ Y???? ¨? L? íb ? ¨? íEi¥ù5 ¨? íEi¥ù5 ? ?1?'ú?1?'ú ? ? o"d? V í¥ ? ` ù ? o"d? V í¥ ? ` ù i O ? ? ¥? ?a ÷"??T7?1Mi O ? ? ¥? ?a ÷"??T7?1M ?1?1?"7 OM?¥'÷¥ í?1?1?"7 OM?¥'÷¥ í ¨?dè ? 4?'?ú ¨?dè ? 4?'?ú 97 ¨? íE ? ¨? íE ? ? 4? LC ? Y¥ í h p V[ ?" Y¥3?7 Y¥ í h p V[ ?" Y¥3?7 ? ?1 %?? 4 Y5 ?? ?B? Y 1 í 't`yN9ü? 4???1 í 't`yN9ü? 4??? ¥ ¨? ? @F íb¥ ¨? ? @F íb è?? ? `¥ í ¨?1 A,B,C,D,Eb Y T3 1 p í ? ` 1 p í ? ` B,C,E ?? ??? ?  í  í  B,Ca??C?31 ía??C?31 í A ?"ü ??"ü ? ê  í ¨?ê  í ¨? . 98 μ í¥?D3" μ í¥?D3" ?  ? μ í? 3 ? μ í? 3 ? 3" μ í3" μ í ? ?? DBMS¥i? e?0"d? ù_?"d?¥i? e?0"d? ù_?"d? ^?i μ í ^?i μ í ? B?_?? μ íü1 !E3"B?_?? μ íü1 !E3" 99 _? μ í _? μ í ? HE ? HE ? ?TB? Y¥?? HW?V ? ?TB? Y¥?? HW?V ? ?¥ HKü a1? 3  μ í ? a? LCe?a? LCe? ? ?? ?? ?μ V ? ? μ íμ V ? ? μ í ? HK ? !?¤ té μ í? 3a HK ? !?¤ té μ í? 3a ? ?# H?C ? ?# H?C 100 μ í¥?D3" ? μ í¥?D3" ? ? 3" μ í3" μ í ? ê4B?) ? μ í}NKl¥ Yê4B?) ? μ í}NKl¥ Y | üh dbN Y?μ¥ ?μ¥| üh dbN Y?μ¥ ?μ¥ í P  ? Y ????/ ?b 101 4.3.3 i??¥ V1?? i??¥ V1?? Ba I 1"¥i??T? ^? ?¥Ba I 1"¥i??T? ^? ?¥ =a ?? £i??T¥? ^? ?¥=a ?? £i??T¥? ^? ?¥ 102 Ba I 1"¥i??T? ^? ?¥Ba I 1"¥i??T? ^? ?¥ ? 9 ?"di? Y?i??T¥? ^¥9 ?"di? Y?i??T¥? ^¥ ?¥7?]¥? V ??á 3?]¥2 ?¥7?]¥? V ??á 3?]¥2 Tb ? | ?μ Y1?  ?¥?| {B? ^? ?¥| ?μ Y1?  ?¥?| {B? ^? ?¥ ?| {b?| {b 103 I 1"¥i??T? ^? ?¥ ? I 1"¥i??T? ^? ?¥ ? ? ? O?? 2TD? BQ?1?13? O?? 2TD? BQ?1?13 ? ? ì H¥2TM] ?? Y A?¥? ? ì H¥2TM] ?? Y A?¥ ? o ?DB?1??M]b ? o ?DB?1??M]b ? ??i??| {?1 V1????i??| {?1 V1??  Serializable ¥?b 104 I 1"¥i??T? ^? ?¥ ? I 1"¥i??T? ^? ?¥ ? ? V1?? ^i? Y? ??¥·B5 V1?? ^i? Y? ??¥·B5 èCμ ? YsYc/ ?T èCμ ? YsYc/ ?T Y 1 B A=B+1 í A Y 2 A B=A+1 í B L !L ! A¥′1 2 B¥′1 2b 105 I 1"¥i??T? ^? ?¥ ? I 1"¥i??T? ^? ?¥ ? ? ? ? Y¥?]?| {? ? Y¥?]?| { ? 1?3? ?1??| {1??| { 1 ?1??| {1??| { 2 ? ?p3??p3? ? ? V1??¥?? V1??¥? ? V1??¥? V1??¥? 106 (a) 1??| {? ?¥? 1??| {? ?¥? Slock B Y=B=2 Unlock B Xlock A A=Y+1 í A(=3) Unlock A Slock A X=A=3 Unlock A Xlock B B=X+1 í B(=4) Unlock B T 1 T 2 107 (b) 1??| {? ?¥?1??| {? ?¥? Slock B Y=B=3 Unlock B Xlock A A=Y+1 í A(=4) Unlock A SlockA X=A=2 Unlock A Xlock B B=X+1 í B(=3) Unlock B T 1 T 2 108 (c) ? V1??¥? ? V1??¥? Slock B Y=B=2 Unlock B Xlock A A=Y+1 í A(=3) Unlock A Slock A X=A=2 Unlock A Xlock B B=X+1 í B(=3) Unlock B T 1 T 2 109 (c) ? V1??¥? ? V1??¥? (? ? ) ? ?? 3?2TD?? 3?2TD (a)a(b)¥2T??]¥2T??] ?[ ^p¥?b ?[ ^p¥?b 110 (d) V1??¥? V1??¥? Slock B Y=B=2 Unlock B Xlock A A=Y+1 í A(=3) Unlock A Slock A ?? ?? ?? X=A=3 Unlock A Xlock B B=X+1 í B(=4) Unlock B T 1 T 2 111 (d) V1??¥? ? V1??¥? ? ? ?? 3?2TD1?? ?? 3?2TD1?? a ¥3?¥3? 2TM] ?[ ^? ?¥?b2TM] ?[ ^? ?¥?b 112  l?T  l?T ? ?] Y]B ? ¥?T?] Y]B ? ¥?T  1 R1 X W2 X  2 W1 X R2 X  3 W1 X W2 X  4 W2 X W1 X 113 i??¥ V1?? i??¥ V1?? Ba I 1"¥i??T? ^? ?¥Ba I 1"¥i??T? ^? ?¥ =a ?? £i??T¥? ^? ?¥=a ?? £i??T¥? ^? ?¥ 114 =a ?? £i??T¥? ^? ?¥=a ?? £i??T¥? ^? ?¥ ? 1  £i??T¥? ??1  £i??T¥? ?? DBMS¥i? e¥i? e ??A?4B?¥ m ? £? ^ V1??A?4B?¥ m ? £? ^ V1 ??¥b ? V ? ? ? B Y3? Hì?  e YV ? ? ? B Y3? Hì?  e Y 3?¥?| {B? ^ V1??¥??93?¥?| {B? ^ V1??¥??9 ^Ke?¥?| {???ZE L=  ^? ^Ke?¥?| {???ZE L=  ^? V?¥y1 ? P¨?? ? s Z ? o' V?¥y1 ? P¨?? ? s Z ? o' ÷b 115 ?? £i??T¥? ^? ?¥ ? ?? £i??T¥? ^? ?¥ ? ?  £i??T?? ??¥ZE £i??T?? ??¥ZE ?  íZE íZE  í  í  Two-Phase Locking e?e? 2PL xp ? HSZE HSZE ? á4ZE á4ZE 116  íxp  íxp ?  íxp¥ = ?  íxp¥ = ? 1.  ?? ? é?a?T- - ?? ? é?a?T- - Y n51¤? ? ¥ í Y n51¤? ? ¥ í 2.  dbB? í-a Y?¤ dbB? í-a Y?¤ ??  e íb ??  e íb 117  íxp ?  íxp ? ? “   ” í¥cl í¥cl ? Ys1 ?¨ Ys1 ?¨ ? ?B¨ ^¤ í9?1 ?Z¨  ?B¨ ^¤ í9?1 ?Z¨  ? ?=¨ ^ db í9?1 l ê¨ b?=¨ ^ db í9?1 l ê¨ b 118  íxp ?  íxp ? è Y 1¥ í? ¥ í?  Slock A ... Slock B ... Xlock C ... Unlock B ... Unlock A ... Unlock C Y 2¥ í? ¥ í?  Slock A ... Unlock A ... Slock B ... Xlock C ... Unlock C ... Unlock B Y 1N o  íxp7 YN o  íxp7 Y 2?N o  xpb?N o  xpb 119  íxp ?  íxp ? ? i?3?¥ ?μ Y (N o  íxp5?i?3?¥ ?μ Y (N o  íxp5? t Y¥ ?μi??| {? ^ V1??¥bt Y¥ ?μi??| {? ^ V1??¥b ?μN o  íxp¥ Y i?3?¥2T ?μN o  íxp¥ Y i?3?¥2T B? ^? ?¥ ? YN o  íxp ^ V1???¥ YN o  íxp ^ V1???¥  sH sH qq 7? ^A1Hq7? ^A1Hq ? V1??¥???B? ?μ Y?A??? V1??¥???B? ?μ Y?A???  íxpb 120  íxp ?  íxp ? T 1 Slock B  B=2 Y=B Xlock A A=Y+1 í A=3 Unlock B Unlock A T 2 Slock A ?? ?? ?? ?? ?? Slock A  A=3 Y=A Xlock B B=Y+1 í B=4 Unlock B Unlock A T 1 Slock B  B=2 Y=B Unlock B Xlock A A=Y+1 í A=3 Unlock A T 2 Slock A ?? ?? ?? ?? Slock A  A=3 X=A Unlock A Xlock B B=X+1 í B=4 Unlock B (a) N o  íxp (b) ?N o  íxp T 1 Slock B  B=2 Y=B Unlock B Xlock A A=Y+1 í A=3 Unlock A T 2 Slock A  A=2 X=A Unlock A Xlock B ?? Xlock B B=X+1 í B=3 Unlock B (c) ?N o  íxp 121  íxp ?  íxp ? ?  íxpD]? μ í¥BQ íE  íxpD]? μ í¥BQ íE ? BQ íE1 p ?? YA?BQ| ?μ1BQ íE1 p ?? YA?BQ| ?μ1 P¨¥ ? ??F í?5ü? ???3 P¨¥ ? ??F í?5ü? ???3 ?yNBQ íEN o  íxp?yNBQ íEN o  íxp ? ? ^  íxpi?1 p YA?BQ| ?? ^  íxpi?1 p YA?BQ| ? μ1 P¨¥ ? ??F íyNN o  íμ1 P¨¥ ? ??F íyNN o  í xp¥ Y V ?? 3 μ íxp¥ Y V ?? 3 μ í 122  íxp ?  íxp ? N o  íxp¥ Y? 3 μ íN o  íxp¥ Y? 3 μ í T 1 Slock B  B=2 Xlock A ?? ?? T 2 Slock A  A=2 Xlock A ?? 123  íxp ?  íxp ? ?  íxpD ?) íxp  íxpD ?) íxp ?  ??] "¥¥xp  ??] "¥¥xp ?  íxp  íxp ?  £i??¥? ?? £i??¥? ?? ? ?) íxp ?) íxp ? ?]?  £ ? Bá??]?  £ ? Bá? ? N o? ?) íxpA ?N o  xpN o? ?) íxpA ?N o  xp 124  í ì  í ì Ba I 1 ^ í ì =aê4 í ì¥e5=aê4 í ì¥e5 125 Ba I 1 ^ í ì Ba I 1 ^ í ì ? X í? í? S í? ^F B? ? ` ¥ í? ^F B? ? ` ¥ ?  í¥` í¥` : ? ?ít ??í ? ?ít ??í è1" ? o? í` è1" ? o? í` ? ? ?í ? ?í : ??′a ??′"?aíFa1"a ì ?[a?? ì?a?? ? o??[a?? ì?a?? ? o? ? t ??í: ? : ì?:at ?: c?t ??í: ? : ì?:at ?: c? 126 I 1 ^ í ì ? I 1 ^ í ì ? ?  í` V[?v9 V[?l í` V[?v9 V[?l è ?? ? oF í?? ? oF í  ? ??′F í ? ??′F í ?  í`¥vl?1 í¥ ì í`¥vl?1 í¥ ì (Granularity) ?  ì í ì í (multiple granularity locking) ? B?"d?] H|?? í ì?]B?"d?] H|?? í ì?] ¥ Yê4¥ Yê4 127 8.7.1  í ì  í ì Ba I 1 ^ í ì =aê4 í ì¥e5=aê4 í ì¥e5 128 =aê4 í ì¥e5 =aê4 í ì¥e5 ?  í¥ ì í¥ ì vl ? "d$ í¥`"d$ í¥`  ? i?i? lú ? "d 7g lv ? ê4 í ìê4 í ì I n í?i? ?y í I n í?i? ?y í "d 7gDi?é? ??"d 7gDi?é? ?? 129 ê4 í ì¥e5 ? ê4 í ì¥e5 ? ? 31) ??1"¥v íF¥¨? Y[31) ??1"¥v íF¥¨? Y[ ? o1 í?ê ? o1 í?ê ? 31) ?v íF¥¨? Y[1"1 í31) ?v íF¥¨? Y[1"1 í ?í ?í ? o) ?  íF¥¨? Y[íF1 í?o) ?  íF¥¨? Y[íF1 í? êê