Index란?
records의 특정 data를 기준으로 빠르게 검색을 할 수 있게 records를 구조화 하는 것
- 원하는 데이터를 빠르게 찾을 수 있게 색인을 하는 것
- 실제 data(record)는 정렬이 되어 있을 수도 있고, 안되있을 수도 있다.
- 구성 : 탐색 키(rid) + 실제 레코드를 가리키는 포인터 (Data record with key value k)
- 장점
- 원하는 data(record)를 쉽게 찾을 수 있다.
- 단점
- index 를 위한 공간이 필요하다.
- 새로운 data를 추가, 삭제, 변경 시 이에 상응되는 인덱스 추가, 삭제, 변경이 필요할 수 있다.(거의 대부분 필요하다.)
Types of Indexes
- single level index
- composite index
- multilevel index
Single Level Index
- 정렬되어 있기 때문에 이진 탐색에 좋다.
- where key = 1003 인덱스가 걸린 컬럼의 where문 =(equality)(equality search)이 빠르다
- 메모리에 index table의 데이터 크기가 본 table의 것보다 작으므로 테이블을 탐색할 수 있는 양이 더 늘어나, 더 많은 양이 한번에 할 수 있기 때문에 탐색시간이 단축된다.
- 인덱스를 primary key에 걸면 Primary Index(기본 인덱스), 다른 컬럼에 걸면 Secondary Index(보조 인덱스) 이다.
Ordered Indexing is of two types
Dense Index