Say what? ;)

Joe, I'm sorry, but the "adds overhead" argument is ridiculous... Your premise is that your program code (written in a HLL, presumably) can determine uniqueness faster than a UNIQUE constraint can.... I would think that most actions like this would involve, at a minimum, a SETLL/IF %equal() block to determine uniqueness. Would that REALLY be faster than DB2 signaling a constraint violation?

As in most of these discussions, so much of the rhetoric is based on outdated notions. We have to UNlearn as readily as learn.

You presume that its better for the developer to control such activity, yet for the case of database integrity, where one would hope that such activities ALWAYS should occur, you're willing to trust that all developers will do it correctly. IMO, if there's a way to enforce these data integrity rules globally, and that eliminates the ability to "forget about it", then there's no contest. Of course, the developer still needs the appropriate error handlers in place, but that's handling just the exceptions.


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of Joe Pluta
Sent: Monday, March 10, 2008 1:24 PM
To: Midrange Systems Technical Discussion
Subject: Re: Which of the SYSIBM tables/views show the row count for

rob@xxxxxxxxx wrote:
Let's keep it simple then. What sound business reason is there to not
have a primary key constraint on the item master file?
Because I control it programmatically and thus I don't need a
constraint. Now, technically, that means that I could get two records
with the same key (it would require two jobs adding the same item at
precisely the same millisecond, but it could conceivably happen). So it
depends on the application. If item masters are added by a human being,
then I would say the constraint is unnecessary. If they are added in
bulk by a batch process, perhaps more of an issue. If you have a process
that tends to add duplicate records, then you probably do need it (of
course, I'd focus on fixing the process).

You're not asking a new question, Rob. We've had the UNIQUE keyword on
logicals and keyed physicals forever, and not always used it for the
simple reason that it added overhead. Should every primary key have a
UNIQUE constraint? That's a business decision. But if I choose not to
have it, it doesn't make my database design bad. It just means I trust
my application and would prefer not to have the extra overhead of the

You want to make this a "good" vs "bad" decision and its simply not that
way. You have to make each decision with the appropriate forethought.


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].