๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ป CS/Database

[DB/1-3. How to Test Serializability]

by kekeyo 2024. 3. 27.
728x90

3๏ธโƒฃ How to Test Serializability


Testing for Conflict Serializability

Precedence graph์˜ Cycle ์œ ๋ฌด๋ฅผ ๊ฒ€์‚ฌ

  • a direct graph where the vertices are the transactions
  • We draw an arc from Ti to Tj if the two transactions conflict, and Ti accesses the data item on which the conflict arises earlier
  • we may label the arc by the item that is accessed
  • Node : ํŠธ๋žœ์žญ์…˜, Edge : ์ถฉ๋Œ์—ฐ์‚ฐ ์žˆ์„ ๋•Œ ๋ฐ์ดํ„ฐ๋ฅผ ๋จผ์ € ์ฝ๋Š” ๋ฐฉํ–ฅ์œผ๋กœ.

⇒ ๋งŒ์•ฝ ์‚ฌ์ดํด ์กด์žฌ? conflict serializable ํ•˜์ง€ ์•Š์Œ -(cycle์ด ์—†์–ด์•ผ ํ•จ)


Precedence Graph

[Example 1]

์‚ฌ์ดํด ์กด์žฌ → ์ถฉ๋Œ ์ง๋ ฌ ๊ฐ€๋Šฅ ์Šค์ผ€์ค„์ด ์•„๋‹˜

 

 

 

[Example 2]

์‚ฌ์ดํด ์กด์žฌํ•˜์ง€ ์•Š์Œ → Conflict Serializable Schedule

 


Cycle Detection

์‚ฌ์ดํด ๊ฒ€์‚ฌ๋Š” N^2 ๋˜๋Š” N+E ์˜ ์‹œ๊ฐ„ ๋ณต์žก๋„๋กœ ๊ฐ€๋Šฅ (N = ์ •์  ์ˆ˜, E = ๊ฐ„์„  ์ˆ˜)

๋งŒ์•ฝ ๊ทธ๋ž˜ํ”„๊ฐ€ ๋น„์ˆœํ™˜์ ? → topological sorting(์œ„์ƒ์ •๋ ฌ)์„ ํ†ตํ•ด serializableํ•˜๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Œ

 


Test for View Serializability

NP-complete ๋ฌธ์ œ์ด๋ฏ€๋กœ precedence ๊ทธ๋ž˜ํ”„๋กœ ํŒ๋‹จํ•  ์ˆ˜ ์—†๋‹ค.

 

728x90