Re: Use of UNIQUEIDENTIFIER vs IDENTITY for PK with VB.NET/SQL2000

From: Greg Linwood (g_linwoodQhotmail.com)
Date: 04/21/04


Date: Wed, 21 Apr 2004 10:30:33 +1000

This topic has been done over many times in this newsgroup, so I suggest you
perform a Google search on this newsgroup & you'll get lots of opinions,
information etc.

One big problem with identities is that they limit your performance tuning
options later as you cannot partition a table that has an identity without
breaking applications that use the database. This is often over-looked
during design phase.

Using a GUID causes a larger storage foot-print which has performance
implications, but I've personally observed this to be of minimal impact,
although others have regularly claimed otherwise. Another advantage of GUIDs
not mentioned in this thread is that they can be safely generated at the
application level, allowing full row generation of related rows (eg order /
orderdetail) at the application layer without round-trips to the database.
This is a commonly used data tier technique. Round trips can really hurt a
db's performance so this argument has substantial merit on it's own.

Readability is often quoted as a reason not to use GUIDs and this may be
important to you, but there are many reasons for / against both GUIDs and
identities, so I suggest you do a search of the newsgroup as there will be
much information for you there..

HTH

Regards,
Greg Linwood
SQL Server MVP

"ES" <enoch.seward@bigfoot.com.REMOVEExtentionToReply> wrote in message
news:uoOtIfxJEHA.2692@tk2msftngp13.phx.gbl...
> My team is about to start a new VB.Net project using SQL2000. During the
> database design phase, I am faced with determining whether to use
> UNIQUEIDENTIFIER or IDENTIDY (int) for Primary Keys on tables. What are
the
> recommendations for DotNet database development? I'm leaning toward the
use
> of IDENTITY with a UNIQUE constraint but my team is used to working with
> GUIDs. I understand the importance of a GUIDs guaranteed uniqueness, but
> can't I achive the same results with the use of a UNIQUE IDENTITY? The
> readability would be greatly increased.
>
> Pros? Cons?
>
> Thanks,
> Enoch
>
>



Relevant Pages

  • RE: Cannot insert duplicate key row in object <tablename> with unique index
    ... | sure SQL server does not know this (I'm using guids extensively in this ... | similar to backing up a database into another database). ... | insert duplicate key row in object tblEntityDetailsEvent with unique index ...
    (microsoft.public.sqlserver.server)
  • Re: Trying to implent (Joe Celkos) Nested Sets, but need more data columns
    ... If GUIDs are used to identify a record ... They exist only in the current PHYSICAL STORAGE for the database. ... ROWID and other proprietary exposed physical locators are ... physical locator is not an identifier and it has no data integrity. ...
    (microsoft.public.sqlserver.programming)
  • Re: identitycolumn as pk
    ... GUIDS would solve the problem i guess but i see different problems with ... What i want to do is insert the data in the new database ... >> columns as primary keys is a commonly used technique so i bet there must ... Changing the database schema ultimately ...
    (microsoft.public.sqlserver.programming)
  • Cannot insert duplicate key row in object <tablename> with unique index
    ... Basically I have 2 tables (tblEntitys and tblEntityDetailsEvent) (well more, ... sure SQL server does not know this (I'm using guids extensively in this ... similar to backing up a database into another database). ...
    (microsoft.public.sqlserver.server)