줄기세포

[DB] Partitioned Table & Index (파티션 테이블, 인덱스) 본문

DB

[DB] Partitioned Table & Index (파티션 테이블, 인덱스)

줄기세포(Stem_Cell) 2022. 3. 16. 17:20

A. 파티션 테이블의 인덱스

파티션 테이블의 인덱스는 Global / Local ||   Prefixed / Nonprefixed 로 나눌 수 있다.

조합하면 경우의 수는 4개

  - Global Prefixed Partition Index

  - Global NonPrefixed Partition Index (실제로는 불가)

  - Local Prefixed Partition Index

  - Local NonPrefixed Partition Index

 

Global은 테이블 파티션 키 인덱스 파티션 키가 다름 / 같은 컬럼에 다른 범위 혹은 테이블과 다른 컬럼으로 인덱스 파티션

Local은 테이블 파티션 키 인덱스 파티션 키가 같음 / 테이블 파티션과 동일 범위로 인덱스도 파티션 (Equi-Partition이라함) 

 

Prefixed는 인덱스 1번 컬럼과 인덱스 파티션 키가 같음

Nonprefixed 인덱스 1번 컬럼과 인덱스 파티션 키가 다름

 

 

B. 아래와 같은 파티션 테이블과 인덱스를 생성했다고 가정해보자.

create table t ( a number, b char(3), c varchar2(10) )
partition by range(a) (
partition p1 values less than(100)
, partition p2 values less than(200)
, partition p3 values less than(maxvalue)
);

create index t_idx on t( b ) local ;
출처: 구루비

정답: Local NonPrefixed Partition Index

 

1. LOCAL? GLOBAL?

    local이라는 옵션을 주었기 때문에, 파티션 키는 테이블 파티션과 인덱스 파티션이 a로 동일함

 

2. Prefixed? Nonprefixed?

    index의 1번 컬럼은 b, 인덱스 파티션 키는 a  -> 다르기 때문에 Nonprefixed

 

C. Global NonPrefixed는 왜 존재 안함?

Global이면 테이블 파티션 키와 인덱스 파티션 키가 다르다. global은 항상 index의 맨 앞 컬럼 값을 이용하여 파티션된다. NonPrefixed는 인덱스 1번 컬럼과 인덱스 파티션 키가 다르다. 서로 조건이 상충하여 존재 하지 않음.

 

 

참조:

http://dbcafe.co.kr/wiki/index.php/%ED%8C%8C%ED%8B%B0%EC%85%98_%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%9D%B8%EB%8D%B1%EC%8A%A4

https://jinkyu.tistory.com/51

https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=kahhy&logNo=60150727162 

https://f1angel.tistory.com/136 

 

 
 

 

 

Comments