As an example, I am building an authentication mechanisim that will use
data in the 3 left tables to determine rights to objects in a
destination table, diagrammed below. In this structure, multiple
records in the left tables will point to multiple records in the right
table. Normally, I would approach this problem using junction tables
(LeftID, RightID) to create many-to-many joins.
However, given the structure of each table is nearly identical (as far
as the linking IDs are concerned), I could also use a single junction
table with columns for each available table ID (LeftID1, LeftID2,
LeftID3, RightID). In this table, only two IDs would be utilized per
row (LeftIDx -> RightID).
In both designs, the needed rights information is returned from fairly
simple views, thus the end result is equivalent. The advantage to the
second, multi-ID junction table design, is a simpler database
structure. However, never using this approach before, I am unsure of
the potential future performance impacts.
Any significant downsides to this second design? Examples of an
abbreviated structure follow:
Data Tables
-----------
LeftTable1
LeftID1 (int)
Data1
LeftTable2
LeftID2 (int)
Data2
LeftTable3
LeftID3 (int)
Data3
DestinationTable
RightID (int)
Data
Linking tables option 1
-----------------------
JunctionTable1
LeftID1
RightID
JunctionTable2
LeftID3
RightID
JunctionTable3
LeftID3
RightID
Linking table option 2
----------------------
Junction
ID1 (int)
ID2 (int)
ID3 (int)
DestinationID (int)