728x90
1οΈβ£ Transaction Concept
Transaction

- transaction : νλμ λ
Όλ¦¬μ μμ
μ μννλ λ°μ΄ν°λ² μ΄μ€ μ°μ°μ μμ
- μννκ³ μ νλ μ°μ°μ λ Όλ¦¬μ λ¨μ
- queryμ μμλ₯Ό κ°μ§λ μ§ν©
Transaction Concept
- A transaction is a unit of database program that accesses and possibly updates various data items
- DBμ μ μ©λλ λͺ¨λ μ°μ° → Read / Write μ°μ°μΌλ‘ λ¨μνν μ μμ
- νΈλμμ : μμ© νλ‘κ·Έλ¨ λ΄μμ DBμ λν΄ read/write μ°μ°μ΄ λμ€λ νλ‘κ·Έλ¨μ μΌλΆ
- Aκ³μ’μμ Bκ³μ’λ‘ $50μ μ‘κΈνλ λ¨μνλ νΈλμμ μμ
read(A)
A = A - 50
write(A)
read(B)
B = B + 50
write(B)
Transaction Management
νΈλμμ κ³Ό κ΄λ ¨λ λ κ°μ§ μ£Όμ μ΄μ?
- Hardware/software/transaction failures
- μ΄λ° λͺ¨λ μ€λ₯ ν΅μΉ → system failure (λ°μνκ² λλ©΄ inconsistentν΄μ§)
- Concurrent execution of multiple transactions (→ μν΄ concurrency control νμ)
.. μ΄κ²λ€μ μ΄λ»κ² ν΄κ²° λ° λ°©μ§ν κ²μΈκ°?λ₯Ό λ°°μ°λ κ² μ£Ό λ΄μ©μ.
Transaction’s ACID properties
⇒ λ°μ΄ν°λ² μ΄μ€ 무결μ±μ μ μ§νκΈ° μν΄ ACID μ±μ§μ κ°μ ΈμΌ ν¨.
- Atomicity (μμμ±) : all or nothing
- Consistency (μΌμΉμ±) : Execution of a transaction in isoltion preserves the consistency of the database
- Isolation (κ³ λ¦½μ±) : λ€μμ νΈλμμ μ΄ μνλκ³ μμ΄λ λ³ΈμΈ νΈλμμ λ§ νλ‘ μνλλ€λ λλ
- Durability (μ§μμ±) : νΈλμμ μ΄ μ±κ³΅μ μΌλ‘ μνλ νμ μμ€ν μ₯μ κ° λ°μνμ¬λ DB μνμ λ°μλμ΄μΌ ν¨
Transaction State

- Active (μν) : The initial state (while it is executing)
- Partially committed (λΆλΆ μλ£) : After the final statement has been executed
- μ partially committed? : logλ₯Ό μ°λ λ± ν΄μΌν μΌμ΄ λ΄λΆμ μΌλ‘ λ¨μμμ
- Aborted (μ² ν) : failure / transaction μ€λ¨ / rollback μνμ λ°μ
- Committed (μλ£) : After successful completion
Concurrent Executions
Concurrent Execution (λμ μν) : λ€μκ°μ νΈλμμ μ λμμ μννλ κ²μ΄ νμ©λ¨
λμ μνμ μ₯μ

- Increased processor and disk utilization, leading to better transaction throughput
- Reduced average response time for transactions: short transactions need not wait behind lone ones
Concurrency Control : λ€μμ νΈλμμ μ λμμ μΌλ‘ μν μ λ°μ΄ν°λ² μ΄μ€ μμ€ν μμ μ΄λ₯Ό μ μ΄νλ κΈ°μ
⇒ isolationμ achieveν μ μμ
728x90
'π©π»βπ» CS > Database' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
| [DB/2-1. Lock-based Protocols] (1) | 2024.03.30 |
|---|---|
| [DB/1-4. Recoverability(ν볡 κ°λ₯)] (0) | 2024.03.27 |
| [DB/1-3.Β How to Test Serializability] (0) | 2024.03.27 |
| [DB/1-2.Serializability(μ§λ ¬μ±)] (1) | 2024.03.24 |