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




"raylopez99" <raylopez99@xxxxxxxxx> wrote in message
news:3dff5f4f-fa62-4721-b887-1229ffdf1388@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Dec 16, 3:00 pm, Hugo Kornelis
<h...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> 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.


RL


.



Relevant Pages

  • Re: Trend towards artificial keys (GUIDs) sez my textbook...is AI next?
    ... after the author said he's a "big fan" of such GUIDs. ... without surrogate keys. ... They MIGHT be introduced during physical design, ... 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. ...
    (comp.databases.theory)
  • Re: Trend towards artificial keys (GUIDs) sez my textbook...is AI next?
    ... after the author said he's a "big fan" of such GUIDs. ... But in the rest of his book, he adds a surrogate key (either GUID ... I believe that logical design should be done completely ... perhaps natural keys are indeed the best bet. ...
    (comp.databases.theory)
  • Re: Whats the best practice for primary keys?
    ... I'm about to start a new project and the decision on primary keys is a ... There is something very 'clean' about using GUIDs, ... This method gets the efficiency of using int keys and allows me to ...
    (microsoft.public.sqlserver.programming)
  • Cracked the about:blank problem!!
    ... REGEDIT will return several keys in HKEY_CLASSES_ROOT ... search the registry for these 2 GUIDs. ... restart in Safe Mode with Command Prompt. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Autoincremental field in VFP7
    ... ALTER TABLE x ALTER COLUMN keyfield Integer NOT NULL PRIMARY KEY ... MCSD, Visual FoxPro MVP ... This type of problem is exactly why I have stayed away from integer keys ... GUIDs for primary keys. ...
    (microsoft.public.fox.helpwanted)