Lets say we have 3 tables (actually I have 2 at the moment, but this example might illustrate the thought better):
[Person]
- ID: int, primary key
- Name: nvarchar(xx)
[Group]
- ID: int, primary key
- Name: nvarchar(xx)
[Role]
- ID: int, primary key
- Name: nvarchar(xx)
[PersonGroupRole]
- Person_ID: int, PRIMARY COMPOSITE OR NOT?
- Group_ID: int, PRIMARY COMPOSITE OR NOT?
- Role_ID: int, PRIMARY COMPOSITE OR NOT?
Should any of the 3 ID's in the relation PersonGroupRole be marked as PRIMARY key or should they all 3 be combined into one composite?? whats the real benefit of doing it or not?
I can join anyways as far as I know, so Person JOIN PersonGroupRole JOIN Group gives me which persons are in which Groups etc.
I will be using LINQ/C#/.NET on top of SQL-express and SQL-server, so if there is any reasons regarding language/SQL that might make the choice more clear, that's the platform I ask about.
Looking forward to see what answers pops up, as I have thought of these primary keys/indexes many times when making combined ones.
EDIT:
Okay, the question was to be misunderstood I can see now.
The question is about, if it makes any sense to mark the three ID's in PersonGroupRole as PRIMARY KEYS for index purpose. Will this add extra speed for joining with each of the three tables, or should they stay without PRIMARY KEY in the PersonGroupRole table and only be Primary in the separate tables.
Sorry, about the confusion. Will try to explain my questions better.