Friday, January 28, 2011

Can Partion column and Primary Index should be same?

YESSSSSSSS NOOOOOOOOOOO...

we can create a Non Unique Priamry index (NUPI) on one column and chooose
other column for Partion

Ex: create an employee table with primary index on employee number and
partion on deptno.

if table has Unique Primary Index , then you should choose one of the
columns used in UPI as Partion column.

I.e If create a UPI on empno and we can't choose deptno for partion


Ex 1: This query is okay
create table employee(eno integer,ename varchar(20),deptno)
primary index(eno)
partition by dept;


Ex 2: This query is Not okay
create table employee(eno integer,ename varchar(20),deptno)
unique primary index(eno)
partition by dept;

1 comment:

  1. Can you please explain in a more detailed way,
    why parition cannot be done by a column not in
    unique primary index?

    As i am unable to undersatnd from a long time,
    your explanation is mostly awaited and admired

    Thanks
    Aditya

    ReplyDelete