dbTalk Databases Forums  

Trend towards artificial keys (GUIDs) sez my textbook...is AI next?

comp.databases.theory comp.databases.theory


Discuss Trend towards artificial keys (GUIDs) sez my textbook...is AI next? in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AI next? - 12-16-2007 , 05:00 PM






On Sun, 16 Dec 2007 03:13:12 -0800 (PST), raylopez99 wrote:

Quote:
On Dec 15, 2:30 pm, Hugo Kornelis
h... (AT) perFact (DOT) REMOVETHIS.info.INVALID> wrote:

If this is the book I think it is (Pro SQL Server 2005 yadda yadda),
then please do me -or rather yourself- a favor and stop trying to learn
database theory from it. There are a lot of things that Louis and I
agree on, but database theory is definitely not among them. Parts of his
book are useful, the art is figuring out which parts.

Best, Hugo

Hugo are you famous? "Louis and I"? I should start hanging out here
more often!
Hi Ray,

Heh! No, I hope not. But neither do I consider Louis to be famous.

I have met Louis a couple of times, we sometimes exchange mails, and we
read (and sometimes comment on) each other's blogs. That why I know what
subjects we do and don't agree on.

(snip)
Quote:
in other parts of the book Louis says he sometimes posts in
Usenet groups, perhaps or in particular even this one--RL
Not this one. Louis hangs around in groups specific to SQL Server. And I
believe that he nowadays spends more times in web Forums and less on
Usenet, but I'm not entirely sure.

Quote:
So, from this passage, I think the author does a good job disclaiming
the slavish use of GUIDs without understanding their drawbacks, even
after the author said he's a "big fan" of such GUIDs.
True. But in the rest of his book, he adds a surrogate key (either GUID
or IDENTITY) to every entity before and without considering whether one
is needed. I believe that logical design should be done completely
without surrogate keys. They MIGHT be introduced during physical design,
but not before.

Best, Hugo


Reply With Quote
  #12  
Old   
raylopez99
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AInext? - 12-17-2007 , 08:58 AM






On Dec 16, 3:00 pm, Hugo Kornelis
<h... (AT) perFact (DOT) REMOVETHIS.info.INVALID> wrote

Quote:
So, from this passage, I think the author does a good job disclaiming
the slavish use of GUIDs without understanding their drawbacks, even
after the author said he's a "big fan" of such GUIDs.

True. But in the rest of his book, he adds a surrogate key (either GUID
or IDENTITY) to every entity before and without considering whether one
is needed. I believe that logical design should be done completely
without surrogate keys. They MIGHT be introduced during physical design,
but not before.
OK I'll keep this in mind when trying to architect a database system--
use natural keys. Which is easier said than done: how unique is
anybody nowadays ('hair color, height, weight, name, shoe size') with
300M Americans and 9B people on the planet? I'm not sure even a GUID
is 100% safe with those big numbers?! Maybe we need biometrics. But
I guess most databases are not designed to be so scalable anyway, so
perhaps natural keys are indeed the best bet.

RL


Reply With Quote
  #13  
Old   
David Cressey
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AI next? - 12-17-2007 , 09:51 AM




"raylopez99" <raylopez99 (AT) yahoo (DOT) com> wrote

Quote:
On Dec 16, 3:00 pm, Hugo Kornelis
h... (AT) perFact (DOT) REMOVETHIS.info.INVALID> wrote

So, from this passage, I think the author does a good job disclaiming
the slavish use of GUIDs without understanding their drawbacks, even
after the author said he's a "big fan" of such GUIDs.

True. But in the rest of his book, he adds a surrogate key (either GUID
or IDENTITY) to every entity before and without considering whether one
is needed. I believe that logical design should be done completely
without surrogate keys. They MIGHT be introduced during physical design,
but not before.

OK I'll keep this in mind when trying to architect a database system--
use natural keys. Which is easier said than done: how unique is
anybody nowadays ('hair color, height, weight, name, shoe size') with
300M Americans and 9B people on the planet? I'm not sure even a GUID
is 100% safe with those big numbers?! Maybe we need biometrics. But
I guess most databases are not designed to be so scalable anyway, so
perhaps natural keys are indeed the best bet.

In another topic, the distinction between "natural", "artificial", and
"surrogate" keys is being discussed. See that discussion for details. For
your purposes, you can take a key as one of the "givens", even if it's
really artificial.

(If you were to take the Latin word "data" and translate it anew into
modern English, the word "givens" might come close.)



The problem with using keys that somebody else gives you is that it isn't
under your control.
If somebody uses the same key twice, or a user enters the wrong value for a
key at initial insert time, you can be hurt by that in ways that a GUID
make it easy to recover from.

But, overall, I'm going to side with the folks who say that GUIDs add
completxity without adding power. There are exceptional situations, but if
you're looking for the general pattern, this is it.


Quote:
RL



Reply With Quote
  #14  
Old   
Bob Badour
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AInext? - 12-17-2007 , 10:02 AM



raylopez99 wrote:

Quote:
On Dec 16, 3:00 pm, Hugo Kornelis
h... (AT) perFact (DOT) REMOVETHIS.info.INVALID> wrote


So, from this passage, I think the author does a good job disclaiming
the slavish use of GUIDs without understanding their drawbacks, even
after the author said he's a "big fan" of such GUIDs.

True. But in the rest of his book, he adds a surrogate key (either GUID
or IDENTITY) to every entity before and without considering whether one
is needed. I believe that logical design should be done completely
without surrogate keys. They MIGHT be introduced during physical design,
but not before.
Hugo, keys are logical constructs. I fail to see their relevance to
physical design.


Quote:
OK I'll keep this in mind when trying to architect a database system--
use natural keys. Which is easier said than done: how unique is
anybody nowadays ('hair color, height, weight, name, shoe size') with
300M Americans and 9B people on the planet? I'm not sure even a GUID
is 100% safe with those big numbers?! Maybe we need biometrics. But
I guess most databases are not designed to be so scalable anyway, so
perhaps natural keys are indeed the best bet.

RL
Ray, there is no simple rule. The design criteria for keys are:
simplicity, familiarity, stability, uniqueness, irreducibility.

You would do yourself a favour by writing them on a post-it note right
about now.

Sometimes they conflict and one has to make tradeoffs. The ideal key
will have all 5 of those properties. Sometimes no such ideal key exists.
At such times, one must understand why each of the above properties is
important and what problems will ensue from not having the property.

Sometimes it is possible to invent something that has all of the above
properties. For example, when an employer assigns a number to every
employee, prints it on a card and tells each employee to include their
number on all correspondence, the employer is inventing exactly such a
key. Employers were doing that long before computers arrived.

I am not exactly sure what you mean when you say "GUID". If you mean a
128 bit number encoded in hexadecimal and broken into fields, such a
thing is neither simple nor familiar to anyone.


Reply With Quote
  #15  
Old   
raylopez99
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AInext? - 12-17-2007 , 01:52 PM



On Dec 17, 8:02 am, Bob Badour <bbad... (AT) pei (DOT) sympatico.ca> wrote:

Quote:
Ray, there is no simple rule. The design criteria for keys are:
simplicity, familiarity, stability, uniqueness, irreducibility.

You would do yourself a favour by writing them on a post-it note right
about now.

Sometimes they conflict and one has to make tradeoffs. The ideal key
will have all 5 of those properties. Sometimes no such ideal key exists.
At such times, one must understand why each of the above properties is
important and what problems will ensue from not having the property.
Bob thanks for that link to the 1989 poster "Five Rules of
Normalization" involving the Puppy Kennel. Very useful, I've gone
over it several times (still can't figure out Rules 4 or 5 but I'll
get it eventually).

Today I learned that Access will not give you an error if you create a
relationship (i.e. migrate a primary key to another table as a foreign
key) between two tables where the second table has a *compound*
primary key that includes a PRIMARY key of the first table (!). I
didn't know that you could do that, I assumed you never could use a
primary key as the primary key of another table, but it makes sense
since you're not really using a primary key again, since the second
table has a _compound_ primary key. Now something tells me that this
compound key is probably not a good key, since it seems to violate
2NF, but that's another point.

Learn something new everyday.

RL


Reply With Quote
  #16  
Old   
mAsterdam
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AInext? - 12-17-2007 , 02:09 PM



raylopez99 wrote:

Quote:
... migrate a primary key to another table ...
There is no movement here. I am not a native english speaker,
but 'migrate' really sets you on the wrong foot.
Try to describe it in a different way.

--
What you see depends on where you stand.


Reply With Quote
  #17  
Old   
raylopez99
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AInext? - 12-17-2007 , 02:13 PM



On Dec 17, 12:09 pm, mAsterdam <mAster... (AT) vrijdag (DOT) org> wrote:
Quote:
raylopez99 wrote:
... migrate a primary key to another table ...

There is no movement here. I am not a native english speaker,
but 'migrate' really sets you on the wrong foot.
Try to describe it in a different way.

--
What you see depends on where you stand.
Louis Davidson's textbook uses the term "migrate" when a PK -->FK (PK
becomes a FK in another dB). He makes it sound like it's standard
usuage; I guess it's not-- but I like the sound of it because in those
"relationship" diagrams the keys are shown with a solid or dashed line
going to another table.

RL


Reply With Quote
  #18  
Old   
Bob Badour
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AInext? - 12-17-2007 , 02:42 PM



raylopez99 wrote:

Quote:
On Dec 17, 8:02 am, Bob Badour <bbad... (AT) pei (DOT) sympatico.ca> wrote:


Ray, there is no simple rule. The design criteria for keys are:
simplicity, familiarity, stability, uniqueness, irreducibility.

You would do yourself a favour by writing them on a post-it note right
about now.

Sometimes they conflict and one has to make tradeoffs. The ideal key
will have all 5 of those properties. Sometimes no such ideal key exists.
At such times, one must understand why each of the above properties is
important and what problems will ensue from not having the property.


Bob thanks for that link to the 1989 poster "Five Rules of
Normalization" involving the Puppy Kennel. Very useful, I've gone
over it several times (still can't figure out Rules 4 or 5 but I'll
get it eventually).

Today I learned that Access will not give you an error if you create a
relationship (i.e. migrate a primary key to another table as a foreign
key) between two tables where the second table has a *compound*
primary key that includes a PRIMARY key of the first table (!). I
didn't know that you could do that, I assumed you never could use a
primary key as the primary key of another table, but it makes sense
since you're not really using a primary key again, since the second
table has a _compound_ primary key. Now something tells me that this
compound key is probably not a good key, since it seems to violate
2NF, but that's another point.

Learn something new everyday.

RL
It is fairly common for something like an order line item to have a
compound key.


Reply With Quote
  #19  
Old   
mAsterdam
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AInext? - 12-17-2007 , 02:59 PM



raylopez99 wrote:
Quote:
mAsterdam wrote:
raylopez99 wrote:

... migrate a primary key to another table ...

There is no movement here. I am not a native english speaker,
but 'migrate' really sets you on the wrong foot.
Try to describe it in a different way.

Louis Davidson's textbook uses the term "migrate" when a PK -->FK (PK
becomes a FK in another dB).
I am in unfamiliar territory here, but 'becomes' still
doesn't sound right. I would use a sentence with 'references'
here, and so - I guess - would most.

--
What you see depends on where you stand.


Reply With Quote
  #20  
Old   
rpl
 
Posts: n/a

Default Re: Trend towards artificial keys (GUIDs) sez my textbook...is AInext? - 12-27-2007 , 05:13 AM



raylopez99 wrote:
Quote:
I'm not sure even a GUID
is 100% safe with those big numbers?! Maybe we need biometrics.
maybe we don't. Biometrics is a measurement, not a key.



rpl

stop fucking trolling.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.