์ธ๋ฑ์ค
๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ถ์ผ์ ์์ด์ ํ ์ด๋ธ์ ๋ํ ๋์์ ์๋๋ฅผ ๋์ฌ์ฃผ๋ ์๋ฃ๊ตฌ์กฐ.
๊ณ ์์ ๊ฒ์ ๋์ ๋ฟ๋ง ์๋๋ผ ๋ ์ฝ๋ ์ ๊ทผ๊ณผ ๊ด๋ จ ํจ์จ์ ์ธ ์์ ๋งค๊น ๋์์ ๋ํ ๊ธฐ์ด๋ฅผ ํ๋ค.
RDBS์์๋ ์ธ๋ฑ์ค๋ ํ ์ด๋ธ ๋ถ๋ถ์ ๋ํ ํ๋์ ์ฌ๋ณธ์ด๋ค.
๊ณ ์ ์ ๊ทผ, ์์คํ ๋ถํ๋ฅผ ์ค์ด๊ธฐ ์ํด์ ์ธ๋ฑ์ค๊ฐ ์ฌ์ฉ๋์ง๋ง ์ถ๊ฐ์ ์ธ ์ ์ฅ๊ณต๊ฐ, ์ธ๋ฑ์ค ๊ด๋ฆฌ๋ฅผ ์ํ ์ถ๊ฐ ์์ ์ด ์๊ตฌ๋๋ค.
External-memory model์ ํตํด ์ธ๋ฑ์ค์ ์ฑ๋ฅ์ ํ์ธํ ์ ์๋ค.
์ธ๋ฑ์ค์ ๊ตฌ์ฑ
Search Key
file ์์ record๋ฅผ ์ฐพ๊ธฐ ์ํ ์์์ ์งํฉ
Index File
ํ์์ Index entries๋ก ๊ตฌ์ฑ.
Ordered Index
Search Key์ ๊ฐ์ผ๋ก ์ ๋ ฌ๋์ด์๋ ์ธ๋ฑ์ค.
Primary Index ( clustering index)
ํ์ผ์ ํน์ ํ ์์๋ฅผ ๊ตฌ์ฒดํ ํ๋ search key.
primary index๋ก ์์๊ณผ ๊ตฌ์ฒดํ ๋ ํ์ผ์ Index-sequential file์ด๋ผ ํ๋ค.
Secondary Index (non-clustering index)
primary index๋ก ๊ตฌ์ฒดํ๋ ์์์ ๋ค๋ฅธ ์์๋ฅผ ์ ํ๊ธฐ ์ํ ์ธ๋ฑ์ค.
Multilevel Index
๋ง์ฝ primary index์ ๋ํ ํ์ผ(dense index, sparse index)๊ฐ main memory์ ์ ํฉํ์ง ์๋ค๋ฉด Multilevel Index ๋ฅผ ์ฌ์ฉํ ์ ์๋ค.
primary index file์ ๋์คํฌ์ ์ ์ฅํ๊ณ (Inner Index), ๊ทธ file์ ๋ํ sparse index(Outer Index)๋ฅผ ๋ฉ๋ชจ๋ฆฌ์ ์ฌ๋ ค์ ์ฌ์ฉํ๋ค.
Hash Index
Key(Index record), Value(record Address)์ ํ์์ผ๋ก Hash Table ๊ธฐ๋ฐ์ผ๋ก ์ ์ฅ๋ Index.
- ๋๋ฑ ๋น๊ต ๊ฒ์์ ์ต์ ํ. ๋ฒ์๋ฅผ ๊ฒ์ํ๊ฑฐ๋ ์ ๋ ฌ์ ์ํด์๋ ์ ํฉํ์ง ์์.
- InnoDB์ ๋ฒํผ ํ์์ ๋น ๋ฅธ ๋ ์ฝ๋ ๊ฒ์์ ์ํ Adaptive Hash Index๋ก ์ฌ์ฉ, ๋ช๋ช DBMS์์๋ JOIN์ ์ฌ์ฉ.
- ์ฃผ๋ก ๋ฉ๋ชจ๋ฆฌ ๊ธฐ๋ฐ ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ ์ฌ์ฉ
B+ tree Index
ํ์ผ์ด ์ปค์ง์๋ก ์ฑ๋ฅ์ด ๋จ์ด์ง๊ณ , ๋ง์ Overflow block์ด ์๊ธฐ๋ index-sequential, hash index file ๋์ ์ฌ์ฉํ๋ Index file data structure์ด๋ค.
์์ค ๋๋ถ๋ถ์ RDBS๋ B+ tree๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฉฐ ๋ณํ ํํ์ธ B-tree, B-*tree ๋ํ ๋ง์ด ์ฌ์ฉ๋๋ค.
B+ tree๋ ๋ค์ ์กฐ๊ฑด์ ๋ง์กฑํ๋ Rooted-tree ํํ์ด๋ค.
- root - leaf์ ๋ชจ๋ ๊ฒฝ๋ก๋ ๊ฐ์ ๊ธธ์ด๋ฅผ ๊ฐ์ง๋ค.
- root์ leaf๊ฐ ์๋ ๋ชจ๋ ๋ ธ๋๋ ceil(n/2), n ์ฌ์ด์ ์์์ ๊ฐ์ง๋ค.
- leaf๋ ceil((n-1)/2), n-1 ์ฌ์ด์ ๊ฐ๋ค์ ๊ฐ์ง๋ค.
- root๊ฐ leaf๊ฐ ์๋๋ผ๋ฉด, ์ด๊ฒ์ ์ ์ด๋ 2๋ช ์ ์์๋ค์ ๊ฐ์ง๋ค.
B+ tree Node
P : non-leaf node๋ ์์์ ๊ฐ๋ฆฌํค๋ ํฌ์ธํฐ, leaf node๋ record์ pointer ๋๋ bockets of records๋ฅผ ๊ฐ๋ฆฌํจ๋ค.
K : search-key value๋ฅผ ๊ฐ๋ฆฌํค๋ฉฐ K1 < Kn-1์ ์์ผ๋ก ์ ๋ ฌ๋์ด์๋ค.
Leaf Node
๊ฐ๊ฐ์ P๋ ๋ฐ์ดํฐ์ ์ค์ ์ฃผ์๋ฅผ ๊ฐ๋ฆฌํค๊ณ , Leaf node์ ๋ง์ง๋ง ํฌ์ธํฐ๋ ๋ค์ leaf node๋ฅผ ๊ฐ๋ฆฌํจ๋ค.
Non-leaf Node
๋ชจ๋ Non-leaf nodes๋ leaf node์ ๋ํ multi-level sparse index์ด๋ค.
Pi๊ฐ ๊ฐ๋ฆฌํค๋ leaf node๋ Ki๋ณด๋ค search key๊ฐ ํญ์ ์๋ค.
'CS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[OS] CPU Scheduling (1) | 2024.09.29 |
---|---|
[OS] Threads, Concurrency (2) | 2024.09.15 |
[OS] Processes (0) | 2024.09.14 |