-
Hi,
If I am given a choice creating a primary key on the table versus a unique index on the table what should be preferred.
I am aware of the differences between the primary key and unique indexes.
Eg:
create table Test(T1 number not null, T2 varchar2(10),
primary key(T1));
or
create table Test(T1 number unique not null, T2 varchar2(10));
I have my entire schema with Primary Key indexes and not a single foreign key.
Does Oracle create a different index structure for a primary key and unique constraints. Will there be any performance issues.
Thanks in Advance
-
Just more typing in the second example because you'll have to create the primary key after you create the unique index.
-
index structure are the same since both are b-tree based
you dont necesary need to create an unique index to enforce primary key, in 8i you can create a non-unique index then add PK to it by doing so when you disable the PK the index wont get dropped, this is an 8i feature mainly for Datawarehouse
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|