Is there any performance problem / difference if I have one Foreign Key that points to another table Indexed Fields that is NOT the PK ?
Something like
DECLARE @T1 TABLE
(
T1_ID INT IDENTITY PRIMARY KEY,
T1_SOMEID INT NOT NULL,
OfficeID VARCHAR(3) NOT NULL,
Data VARCHAR(200) NOT NULL
);
DECLARE @T2 TABLE
(
T2_ID INT IDENTITY PRIMARY KEY,
T1_SOMEID_FK INT NOT NULL,
OfficeID VARCHAR(3) NOT NULL,
OtherData VARCHAR(100) NOT NULL
);
QUESTION:
Is there a performance drop when I run a query that looks like this:
SELECT t1.T1_ID, t1.Data, t2.T2_ID, t2.OtherData
FROM @T1 t1
INNER JOIN @T2
ON t1.T1_SOMEID = t2.T1_SOMEID_FK
AND t1.OfficeID = t2.OfficeID