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



raylopez99 wrote:

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.

Hugo, keys are logical constructs. I fail to see their relevance to physical design.


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.
.



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. ... But in the rest of his book, he adds a surrogate key (either GUID ... I believe that logical design should be done completely ... without surrogate keys. ...
    (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)
  • Re: numbering my records based on a grouping
    ... Learn SQL and RDBMS, so that your tables will have keys in the future; ... right now you are a danger to your employer and should not be allowed ...
    (microsoft.public.sqlserver.programming)