On Jul 30, 2014, at 9:04 AM, Rich Shepard <rshep...@appl-ecosys.com> wrote:

> On Wed, 30 Jul 2014, Werner wrote:
> 
>> I don't like using 'name' columns as primary keys I would instead use an
>> 'id' column and would set 'index=True' on the name column.
> 
> Werner,
> 
>  The use of natural keys (such as a vehicle VIN, the US's SSN, or equipment
> serial number) is prefered over an artificial, meaningless, integer key to
> prevent duplicate data. See any of Joe Celko's SQL books.

Celko's books are great but surrogate integer PKs are an unavoidable practice 
within relational databases, they are a requirement of most DBAs I've dealt 
with as they perform predictably in terms of indexing and space requirements, 
especially considering that a PK implies the format of all the FKs that will 
refer to it.  Typically a UNIQUE constraint is placed on the "natural" key to 
prevent dupes.

In my own experience we actually tried using meaningful UUIDs as primary keys 
in a project some years ago and it was an utter disaster.   All PK / FK indexes 
quadrupled in space and performance suffered terribly.  This was on a 
Postgresql backend which should have been a better performer in a non-standard 
context like that (on a big ol' DB like SQL server, forget it).


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to