Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
primary key is always needed.
If, according to the logic of your application, only one user in each service_id can correspond to one user_id, then PK for the first two fields.
If there are several, then pk into 3 fields.
The order of the fields when specifying the PK of the link table is important. Very important for mysql/innodb, because the table is clustered by PK, and any access to the secondary key results in a search by PK (except for covering indexes). Choose the order based on the most frequent requests to the table, so that the maximum requests can go by the primary key.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question