[본글은 고려대학교 정보대학 정순영 교수님 COSE 371 데이터베이스 수강중 중간고사 정리를 위해 작성하는 글임을 밝힙니다.]
Magnetic Hard Disk Mechanism
Platter: 우리가 흔히 생각하는 CD라고 생각하면 된다.
Track: Platter 하나에 50K-100K 개가 존재한다.
Sector: Track 하나당 500~2000개
성능 분석 지표 : Access time= Seek time + Rotational delay
Seek time: Read/write Head가 track까지 이동하는데 걸리는 시간.
Rotational delay: platter rotate해 sector가 read write head에 도달할 때까지 걸리는 시간
Query Processing & Optimization
sql query -> parse(parse tree 생성) -> translate(logical query execution plan ) ->generate equivalent expressions using equivalence rules -> estimate result size -> consider physical plan -> estimate cost -> pick best plan
Transaction
Transaction is a unit of program execution that access and possibly updates various data items
ACID properties
Atomicity: Transaction의 모든 operation이 database에 반영되거나, 전부 반영 되지 않아야 한다.
Consistency: Database의 consistency가 유지가 되어야 한다.
Isolation: Concurrent execution에서 각각의 transaction은 서로에 대해 unaware해야하며, 이는 concurrency control을 통해서 이루어진다.
Durability: Transaction이 successfully하게 complete 됐다면, system failure 여부와 상관 없이 database에 persistant하게 저장이 되어야 한다.
Transaction Isolation
Dirty Read: Session can read rows changed by transaction in different sessions that have not commited
Non-repeatable read: 값을 read 해오고, another session이 changes the row and commits its transaction 한다면, 바뀐 값을 보게 될 것이다.
Phantom: 값을 읽어오고, 새로운 값이 추가가 된다면, 처음 보는 결과 값을 보게 될 것이다.
2 Phase locking protocol
Concurrrency control을 위해 data item을 읽기 위한 lock을 요청함.
단점: 2 phase locking protocol은 deadlock으로부터 자유롭지 못하고, Cascading roll back(연쇄적인 롤백)이 일어날수도 있다.
이를 방지하기 위해 Strict two phase locking이 등장한다.
Strict two phase control: Transaction이 commit/abort 하기 전까지 exclusive lock을 hold하는 것을 의미한다.
Rigorous two phase control: Transaction이 commit/abort 하기 전까지 exclusive/ shared lock을 hold하는 것을 의미함.
Level of consistency in sql
Serializable: 순차적으로 진행이 되기 때문에 isolation 정도가 가장 높으며, dirty read, non-repeatable read, phantom이 일어날 여지가 없다
Repeatable read:
read Commited:
read Uncommited:
'DataBase' 카테고리의 다른 글
[데이터베이스] SQL 개념 정리 (1) | 2024.06.04 |
---|---|
[데이터베이스] 주요 개념 정리 1 (0) | 2024.04.10 |