Showing posts with label relationships. Show all posts
Showing posts with label relationships. Show all posts

Friday, March 9, 2012

PK vs Unique Clustered Index

When not using any enforced relationships in a database (which I know we should, but I like most of you, have inherited sub-optimal design), is there any real difference between using a Primary Key (to which no foreign keys are tied) and using a Unique Clustered index?

Thanks for your thoughts

Other that the NULL value issue, both will maintain uniqueness if that is your purpose.

|||

Yeah, the "UNIQUE" will assure uniqueness. I know that created a PK on a table creates a UNIQUE CLUSTERED index on whatever field(s) are included in the key.

My question is, is there a real difference between creating a PK on a table, and creating the equivalent UNIQUE CLUSTERED INDEX on the same table instead of a PK? If the PK is not referenced in any FK, then in my thinking, there is no difference.

Thoughts...anyone?

PK vs Unique Clustered Index

When not using any enforced relationships in a database (which I know we should, but I like most of you, have inherited sub-optimal design), is there any real difference between using a Primary Key (to which no foreign keys are tied) and using a Unique Clustered index?

Thanks for your thoughts

Other that the NULL value issue, both will maintain uniqueness if that is your purpose.

|||

Yeah, the "UNIQUE" will assure uniqueness. I know that created a PK on a table creates a UNIQUE CLUSTERED index on whatever field(s) are included in the key.

My question is, is there a real difference between creating a PK on a table, and creating the equivalent UNIQUE CLUSTERED INDEX on the same table instead of a PK? If the PK is not referenced in any FK, then in my thinking, there is no difference.

Thoughts...anyone?