๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
์Šคํ„ฐ๋””/๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค

[CS186] Introduction to Database Systems - Week 3

by moon101 2023. 5. 13.

โ›… B+ Trees โ›…

์ธ๋ฑ์Šค

2. Properties

  • ์ •๋ ฌ๋˜์–ด ์žˆ๊ณ  ์ž์‹ ์†์„ฑ์„ ๊ฐ€์ง€๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํŠธ๋ฆฌ ์•„๋ž˜๋กœ leaf๋ฅผ ์ˆœํšŒํ•˜๋ฉด์„œ ์›ํ•˜๋Š” ํŠน์ • record๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค (BSTs, binary search trees์™€ ๋น„์Šทํ•จ)

5. Sorting Records

Alternative 1: By Value

  • leaf pages = data pages
  • ๋ ˆ์ฝ”๋“œ์— ๋Œ€ํ•œ ํฌ์ธํ„ฐ๋ฅผ๊ฐ€ ์•„๋‹Œ ์‹ค์ œ๋กœ ๋ ˆ์ฝ”๋“œ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค
  • ๊ตฌํ˜„ํ•˜๊ธฐ ์‰ฝ์ง€๋งŒ ๊ฐ™์€ ํŒŒ์ผ์— multiple indexes๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์—†๋‹ค๋Š” ๋‹จ์ ์ด ์žˆ๋‹ค

Alternative 2: By Reference

  • leaf pages๋Š” ํ•ด๋‹นํ•˜๋Š” ๋ ˆ์ฝ”๋“œ์˜ ํฌ์ธํ„ฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค
  • multiple indexes๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค

Alternative 3: By List of References

  • leaf pages๋Š” ํฌ์ธํ„ฐ ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค

 

6. Clustering

๋ฐ์ดํ„ฐ ํŽ˜์ด์ง€์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ์–ด๋–ป๊ฒŒ ์ •๋ฆฌ๋˜์–ด ์žˆ๋Š”์ง€

 

unclustered

  • ์ •๋ˆ๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค

clustered

  • ๋ฐ์ดํ„ฐ ํŽ˜์ด์ง€๊ฐ€ B+ tree์˜ ์ธ๋ฑ์Šค์™€ ๊ฐ™์ด ์ •๋ ฌ๋˜์–ด ์žˆ๋‹ค. ์ธ์ ‘ํ•œ ํ‚ค๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” 2๊ฐœ์˜ ๋ ˆ์ฝ”๋“œ๋Š” ๊ฐ™์€ ํŽ˜์ด์ง€์— ์œ„์น˜ํ•  ํ™•๋ฅ ์ด ํฌ๊ธฐ ๋•Œ๋ฌธ์— 2๋ฒˆ์งธ ๋ ˆ์ฝ”๋“œ๋ฅผ ์ฝ์„ ๋•Œ๋Š” ์บ์‹œ๋œ ํŽ˜์ด์ง€์—์„œ ๊ฐ€์ ธ์˜ค๋ฉด ๋œ๋‹ค
  • unclustered ์ธ๋ฑ์Šค์™€ ๋น„๊ตํ•ด์„œ clustered ์ธ๋ฑ์Šค๋Š” ๋ฒ”์œ„ ํƒ์ƒ‰์— ์œ ๋ฆฌํ•˜์ง€๋งŒ ์œ ์ง€ํ•˜๋Š” ๋น„์šฉ์ด ๋” ํฌ๋‹ค

 

7. Counting IO's

  • 1. read the appropriate root-to-leaf-path
  • 2. read the appropriate data page(s)
  • 3. write data page
  • 4. update index page(s)

 

 

 

 

๋Œ“๊ธ€