• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Table partitioning in Oracle Database
 

Table partitioning in Oracle Database

on

  • 569 views

ORACLE TABLE PARTITIONING

ORACLE TABLE PARTITIONING

Statistics

Views

Total Views
569
Views on SlideShare
569
Embed Views
0

Actions

Likes
1
Downloads
4
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Table partitioning in Oracle Database Table partitioning in Oracle Database Presentation Transcript

    • RANGE PARTITIONINGCREATE TABLE abc ( prod_id NUMBER(6) , cust_id NUMBER, time_id DATE , channel_id CHAR(1) , promo_id NUMBER(6) ,quantity_sold NUMBER(3) , amount_sold NUMBER(10,2) )PARTITION BY RANGE (time_id) ( PARTITION sales_q1_2006VALUES LESS THAN (TO_DATE(01-APR-2006,dd-MON-yyyy))TABLESPACE tbs1 , PARTITION sales_q2_2006 VALUES LESSTHAN (TO_DATE(01-JUL-2006,dd-MON-yyyy)) TABLESPACEtbs2 ,PARTITION sales_q3_2006 VALUES LESS THAN(TO_DATE(01-OCT-2006,dd-MON-yyyy)) TABLESPACE tbs3,PARTITION sales_q4_2006 VALUES LESS THAN(TO_DATE(01-JAN-2007,dd-MON-yyyy)) TABLESPACE tbs4);
    • LIST PARTITIONINGCREATE TABLE sales_list (salesman_idNUMBER(5),salesman_name VARCHAR2(30), sales_stateVARCHAR2(20),sales_amount NUMBER(10), sales_date DATE)PARTITION BY LIST(sales_state) ( PARTITIONsales_west VALUES(California, Hawaii),PARTITION sales_east VALUES (New York,Virginia, Florida),PARTITION sales_central VALUES(Texas,Illinois)PARTITION sales_other VALUES(DEFAULT) );
    • HASH PARTITIONINGCREATE TABLE dept (deptno NUMBER, deptnameVARCHAR(32))STORAGE (INITIAL 10K) PARTITION BYHASH(deptno)(PARTITION p1 TABLESPACE ts1, PARTITION p2TABLESPACE ts2,PARTITION p3 TABLESPACE ts1, PARTITION p4TABLESPACE ts3);
    • RANGE-HASH PARTITIONINGCREATE TABLE sales ( prod_id NUMBER(6) , cust_idNUMBER , time_id DATE ,channel_id CHAR(1) , promo_id NUMBER(6) ,quantity_sold NUMBER(3) ,amount_sold NUMBER(10,2) ) PARTITION BY RANGE(time_id)SUBPARTITION BY HASH (cust_id) SUBPARTITIONS 8 STORE IN(ts1, ts2, ts3, ts4)( PARTITION sales_q1_2006 VALUES LESS THAN(TO_DATE(01-APR-2006,dd-MON-yyyy)), PARTITION sales_q2_2006 VALUES LESS THAN(TO_DATE(01-JUL-2006,dd-MON-yyyy)) ,PARTITION sales_q3_2006 VALUES LESS THAN(TO_DATE(01-OCT-2006,dd-MON-yyyy)) ,PARTITION sales_q4_2006 VALUES LESS THAN (TO_DATE(01-JAN-2007,dd-MON-yyyy)) );
    • RANGE-LIST PARTITIONINGCREATE TABLE quarterly_regional_sales (deptno number,item_no varchar2(20),txn_date date, txn_amount number, state varchar2(2))TABLESPACE ts4 PARTITION BY RANGE (txn_date)SUBPARTITION BY LIST(state) (PARTITION q1_1999 VALUES LESS THAN (TO_DATE(1-APR-1999,DD-MON-YYYY))(SUBPARTITION q1_1999_northwest VALUES (OR, WA),SUBPARTITION q1_1999_southwest VALUES(AZ, UT, NM), SUBPARTITION q1_1999_northeast VALUES(NY, VM, NJ),SUBPARTITION q1_1999_southeast VALUES (FL, GA),SUBPARTITION q1_1999_northcentral VALUES (SD, WI),SUBPARTITION q1_1999_southcentral VALUES (OK, TX) ),
    • PARTITION q2_1999 VALUES LESS THAN (TO_DATE(1-JUL-1999,DD-MON-YYYY))(SUBPARTITION q2_1999_northwest VALUES(OR, WA),SUBPARTITION q2_1999_southwest VALUES(AZ, UT, NM),SUBPARTITION q2_1999_northeast VALUES(NY, VM, NJ),SUBPARTITION q2_1999_southeast VALUES(FL, GA),SUBPARTITION q2_1999_northcentralVALUES (SD, WI),SUBPARTITION q2_1999_southcentralVALUES (OK, TX) ),
    • PARTITION q3_1999 VALUES LESS THAN (TO_DATE(1-OCT-1999,DD-MON-YYYY))(SUBPARTITION q3_1999_northwest VALUES (OR,WA),SUBPARTITION q3_1999_southwest VALUES (AZ,UT, NM),SUBPARTITION q3_1999_northeast VALUES (NY,VM, NJ),SUBPARTITION q3_1999_southeast VALUES (FL,GA),SUBPARTITION q3_1999_northcentral VALUES(SD, WI),SUBPARTITION q3_1999_southcentral VALUES(OK, TX) ),
    • PARTITION q4_1999 VALUES LESS THAN (TO_DATE(1-JAN-2000,DD-MON-YYYY))(SUBPARTITION q4_1999_northwest VALUES (OR,WA),SUBPARTITION q4_1999_southwest VALUES (AZ,UT, NM),SUBPARTITION q4_1999_northeast VALUES (NY,VM, NJ),SUBPARTITION q4_1999_southeast VALUES (FL,GA),SUBPARTITION q4_1999_northcentral VALUES(SD, WI),SUBPARTITION q4_1999_southcentral VALUES(OK, TX) ) );
    • INDEX ORGANIZED TABLECREATE TABLE country( country_id CHAR(2)CONSTRAINT country_id_nn NOT NULL,country_name VARCHAR2(40),currency_name VARCHAR2(25),currency_symbol VARCHAR2(3),map BLOB,flag BLOB,CONSTRAINT country_c_id_pkPRIMARY KEY (country_id))ORGANIZATION INDEXTABLESPACE indxPCTTHRESHOLD 20OVERFLOW TABLESPACE users;
    • CLUSTURED TABLES# Create the clustercreate cluster emp_dept( deptno number(3)) tablespace users;# Create the two tables that are partof the clustercreate table dept ( deptno number (3)primary key) cluster emp_dept (deptno);create table emp ( empno number (5)primary key, ename varchar2(15), deptnonumber (3) references dept) clusteremp_dept (deptno);