What is the diffrence between a unique index and a unique key?
What is the diffrence between a unique index and a unique key?
Here are few key differences:
Purpose:
Filter Option:
Storage Option:
Icon:
The functionalities are more or less same, it’s dependent on your use case.
Suppose you want to permit duplicate rows based on CUSTOMER_ID and TEAM_NAME.
In that case you can use both:
idx_customer_id_name (CUSTOMER_ID,TEAM_NAME)unique_key_customer_id_name (CUSTOMER_ID,TEAM_NAME)But you should consider how often you fetch records based on CUSTOMER_ID AND TEAM_NAME. If it is more, then you should use unique index as it would help in faster retrieval of records otherwise you should go with unique key as it would prevent overheard of fetching based on index.