On Wed, Jun 14, 2017 at 9:46 AM, Steve Needles
<Stephen.Needles@xxxxxxxxxxx> wrote:
As mathematics has proven time and again,
a + b = b + a
Well, this holds for common "lay person" arithmetic on numbers. It
doesn't *necessarily* hold for all "addition" operations on all sets.
A simple counterexample is when '+' is defined as the concatenation of
strings (and this is just as much a mathematics thing as it is a
computer science thing; it could be and has been argued that computer
science is merely a branch of mathematics anyway).
The need for 2 unique keys to be defined as mirrors of one another is beyond my comprehension this early in the morning. You know...because a + b = b + a...right?
Um, unnecessary, yes. Because of commutativity, no. If anything, a
compound key involves concatenation, which is not commutative. What
makes one of the uniqueness constraints redundant is that there is a
one-to-one and onto mapping from one set of elements to the other.
But the question isn't about whether both constraints are needed. OP
already said he realizes one of them is redundant. The question is
whether keeping both has any negative consequences. It has been
suggested that the SQL engine *might be* sophisticated enough that
there is no discernible performance penalty. But no one has yet stated
that they know for sure one way or the other. Which isn't at all
surprising, given the engine's complexity.
The only way to know for sure is to measure performance with and
without the second uniqueness constraint.
John Y.
As an Amazon Associate we earn from qualifying purchases.