Thursday, February 8, 2018

What is a Hash Partition in Oracle








/* =========================================================================*/
DROP TABLE EMP_HASH;

CREATE TABLE EMP_HASH
  (
    EMPNO    NUMBER(4,0) ,
    ENAME    VARCHAR2(10 ),
    JOB      VARCHAR2(9 ),
    MGR      NUMBER(4,0),
    HIREDATE DATE,
    SAL      NUMBER(7,2),
    COMM     NUMBER(7,2),
    DEPTNO   NUMBER(2,0)
  )
  PARTITION BY HASH ( EMPNO )
  PARTITIONS 4
  ENABLE ROW MOVEMENT;
 
insert into EMP_HASH select * from EMP;
commit;


BEGIN
 DBMS_STATS.gather_table_stats('SDEV', 'EMP_HASH');
END;
 /


select * from EMP_HASH where empno=7369;

No comments:

Post a Comment