I completely, wholehearted, 100% agree. GUID is the WAY to go -
started using them as PKs back in 2004 I think, when I was asked to
unify the databases of a program created by me and installed initially
in two different locations. 1 year later they came and said "well,
Grig, can you put them together?". Guess what, they were using
integers identity as keys. Well, I was pretty much f*cked up for one
week or so, writing scripts to re-sync those damn integers. Moved to
GUIDs and never looked back.

I heard concers about speed of GUIDs versus integers. While integers
are indeed faster, the difference is not that big at all.

If anyone is concerned, have a look here:

http://www.informit.com/articles/printerfriendly.aspx?p=25862

1,000,000 orders table. Integers - 1, GUID - 1.05 (relative to
integers). Pros - you never ever ever need to resync anything, cons -
5%  longer query. Come on, gimme a break. ;) For a resonable number of
records downloaded from server the difference is imperceptible from
user's point of view.

And here: http://blogs.x2line.com/al/archive/2005/09/02/1233.aspx

And the best of all - here: http://krow.livejournal.com/497839.html
(it even has a graph that shows that the performance of "auto"
(MySQL's autoincrement field) and UUIDs (MySQL's equivalent of GUID)
are pretty much similar on InnoDB databases (the ones that suport
foreign keys and transactions).

I rest my case now ;)

On Fri, May 28, 2010 at 5:25 PM, Stephen Russell <[email protected]> wrote:
> On Fri, May 28, 2010 at 8:46 AM, Grigore Dolghin <[email protected]> wrote:
>> In adition to Stephen's message - there is a function in SQL server
>> named SCOPE_IDENTITY() which returns the last ID inserted by you, even
>> if someone else already inserted records.
>>
>> Select Scope_Identity() As MyLastId
>>
>> I don't remember exactly when it was introduced, I guess SQL Server
>> 2005, but anyway. Check it out.
> --------------------
>
> I don't need no stinkin return for my key value.
>
> Guid ID = Guid.NewGuid();
>
> I make them myself!
>
>
> --
> Stephen Russell
>
> Sr. Production Systems Programmer
> CIMSgts
>
> 901.246-0159 cell
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to