Re: Stupid Database Tricks

From: Brian Selzer <brian_at_selzer-software.com>
Date: Wed, 23 May 2007 07:00:25 -0400
Message-ID: <d9V4i.6084$4Y.5622_at_newssvr19.news.prodigy.net>


Now, now, Marshall. System-generated surrogates can simplifiy things if

(1) the database is temporal--particularly historical,
(2) some constraints are temporal,
(3) keys may be updated and either (1) or (2),
(4) the schema may evolve and (1), or
(5) you want to mitigate the impact of (3) or (4).


"Marshall" <marshall.spight_at_gmail.com> wrote in message news:1179892760.282700.315160_at_q66g2000hsg.googlegroups.com...
> On May 22, 1:48 pm, Bob Badour <bbad..._at_pei.sympatico.ca> wrote:
>>
>> Every table will have a numeric id column, and this column will be the
>> primary key.
>
> I don't know why, exactly, since it's not like it's the worst one
> mentioned, but that one DRIVES ME CRAZY!
>
> I hear people say this, and I want to say oh, I see: you're
> just the stupidest freaking idiot ever, is that it? Of course
> instead I say something about that being contraindicated.
>
> My extra special favorite: there's a table that's *just* two
> foreign keys to two different tables; a basic join table. The
> pair (key1, key2) is unique of course. And oh yeah, we
> have to add an additional numeric primary key.
>

Only if you need to track changes to that table over time. Of course, then it wouldn't be a simple junction table, since you have to also add an interval attribute also.

> Grrrrr.....
>
>
>> For performance, we enforce integrity in the application.
>
> Aiiieeee!!!
>
>
> Marshall
>
Received on Wed May 23 2007 - 13:00:25 CEST

Original text of this message