General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
John,
from normalization point of view you should create a table that holds the primary keys of both related tables and its own pk.
For such a table I create three indices:
- the pk of the table (+ index)
- the fk (foreign key) of the first table (+ index)
- the fk of the second table (+ index)
I don´t see the need to create a concatenated index. Why do you want to create such an index? If you are going the query the table it will be on either one of the fk´s. Having an index for each of them is enough. There is no need to join them in a string.
The combinations of the fk´s do not need to be unique, the relation is n:m.
Hope this helps.
Regards,
Ron
>Hi,
>Thank you for your info.
>My further question is,
>if I have a many-to-many relationship table, how should I build up the candicate index to ensure the uniqueness which contain 2 integer value?? Should I just add 2 integer or STR() them and join it as string?
>
>Thank you
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only