Subject | N to N relationship |
---|---|
Author | Pablo Sánchez |
Post date | 2004-11-09T17:00:54Z |
I'm trying to resolve this case without duplicating attributes on
indices. I have:
TableA
id_A long (PK)
...
TableB
id_B long (PK)
...
and
TableAB
id_A long (FK)
id_B long (FK)
...
I need a PK for TableAB, but if i use both, id_A and id_B for such
purpose, I end with an index with contains duplicate attributes, which
is very inconvenient (at least for inserting and planning).
For duplicate attributes, i mean, they're already on other index.
As far as i'm concerned, i cannot build an index with both attributes
that can be used for PK and FK purposes (do I ? ) .
Also a check constraint uses an index (AFAIK).
Is there a new id for the N to N table the only (clean) way out here ?
Best regards.
--
Pablo Sánchez
indices. I have:
TableA
id_A long (PK)
...
TableB
id_B long (PK)
...
and
TableAB
id_A long (FK)
id_B long (FK)
...
I need a PK for TableAB, but if i use both, id_A and id_B for such
purpose, I end with an index with contains duplicate attributes, which
is very inconvenient (at least for inserting and planning).
For duplicate attributes, i mean, they're already on other index.
As far as i'm concerned, i cannot build an index with both attributes
that can be used for PK and FK purposes (do I ? ) .
Also a check constraint uses an index (AFAIK).
Is there a new id for the N to N table the only (clean) way out here ?
Best regards.
--
Pablo Sánchez