|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newbie Table Design QuestionDear All,
I am looking over the design of another person's Database and I find that nearly all tables have Primary Keys and also a column called: rowguid - uniqueidentifier - with a (newid()) default value Why would the designer need a primary key and a GUID in every table. I am confused. Thanks again. Alastair MacFarlane The GUIDs may be for the purposes of Replication. Or they may just be
surrogate keys. Some people like to use GUIDs as surrogate keys, although for reasons of size and practicality I think that's a bad idea as a general rule. -- David Portas SQL Server MVP -- Hi
The Basic Normalization rule of Atomicity is generally achieved through PK.This is used for reference and joins. But Unique Identifier as name suggests is said to be globally unique(takes 16 bytes). The limitation of this using as a primary key is that it is too big hindering the performance.It appears to me that he initially tried to use unique identifier as PK later perhaps found that using Natural key increases the performance. This is only my guess. Unqueidentifier is also useful when you want to use union between two table when merged Horizantally and still force uniqness. This may not be possible with table level PK. This can be handy if one wants to enforce uniqueness in partioned views(I guess Last one) Regards R.D Show quote "Alastair MacFarlane" wrote: > Dear All, > > I am looking over the design of another person's Database and I find that > nearly all tables have Primary Keys and also a column called: > > rowguid - uniqueidentifier - with a (newid()) default value > > Why would the designer need a primary key and a GUID in every table. I am > confused. > > Thanks again. > > Alastair MacFarlane |
|||||||||||||||||||||||