{データベースの作成その他}クラスタ化表,クラスタ索引を作成

 

https://docs.oracle.com/cd/F19136_01/admin/managing-clusters.html#GUID-FA18571F-1EEA-4F25-BC7E-175CD264DC72


DROP CLUSTER emp_dept INCLUDING TABLES;

 

CREATE CLUSTER emp_dept (deptno NUMBER(3))
   SIZE 600
   TABLESPACE users;

CREATE TABLE dept (
   deptno NUMBER(3) PRIMARY KEY)
   CLUSTER emp_dept (deptno);

CREATE TABLE emp (
   empno NUMBER(5),
   ename VARCHAR2(15) NOT NULL,
   deptno NUMBER(3),
   constraint emp_pk primary key(empno),
   constraint emp_fk foreign key(deptno) references dept(deptno)
   )
   CLUSTER emp_dept (deptno);  

select * from user_tables where table_name in('EMP','DEPT');


select * from dba_clusters;

 


CREATE INDEX emp_dept_index
   ON CLUSTER emp_dept
   TABLESPACE users;

select * from user_indexes where index_name ='EMP_DEPT_INDEX';