5) Global secondary index

클러스터 시스템 전체에서 레코드에 고유값을 부여하여, 데이터(샤드)가 다른 그룹으로 이동되어도 해당 고유값(GRID)는 변경되지 않도록 하여 빠른 검색이 가능하도록 하기 위한 객체이다.
global secondary index는 사용자가 컨트롤하는 인덱스가 아니다. 테이블 별 생성 여부 선택이 가능하며 테이블 당 하나만 생성할 수 있다. global secondara index를 생성 한 테이블은 레코드 별 GRID 값이 존재하여 클러스터 내 유일성이 보장된다.

구문을 통한 global secondary index 생성
create table g1 (i1 int) WITH GLOBAL SECONDARY INDEX g1_global_secondary_index;

프로퍼티를 통한 기본 생성여부 설정
- DEFAULT_GLOBAL_SECONDARY_INDEX_CREATION

Cluster system에서 테이블에 대한 non-deterministic 질의를 수행하기 위해서는 global secondary index가 반드시 필요하다.
만약 테이블에 global secondary index가 없을 경우 non-deterministic 질의는 실패한다.

non-deterministic query
- cluster member 들이 동일한 row 에 대해 동일한 값으로 변경한다고 보장할 수 없는 질의
- global secondary index 없이 테이블 생성하는 경우, 사용할 수 없는 SQL

non-deterministic query 예시
* seq_name.currval / seq_name.nextval / next value for seq_name
* currval(), nextval()
* random()
* clock_date(), clock_time(), clock_timestamp(), clock_localtime(), clock_localtimestamp()
* psm - schema level function
* offset limit clause

gSQL> select * from c1 limit 1 for update;
ERR-42000(16423): does not support non-deterministic DML in the cluster system : global secondary index expected

gSQL> delete from t1 limit 1;
ERR-42000(16423): does not support non-deterministic DML in the cluster system : global secondary index expected


'IT Engineer > Database' 카테고리의 다른 글

cluster shard  (0) 2019.02.13
cluster failover  (0) 2019.02.13
global sequence  (0) 2019.02.13
Application단에서의 AUTO-COMMIT ON/OFF 여부에 따른 성능 차이  (2) 2018.09.19
메모 메모 identified colums value  (0) 2018.09.19

+ Recent posts