Scenario:
I have a design where a user can create a profile and he gets a profile_id. Now I have a global table called item where I save the items that the customer created. That means that the primary key of the item table consists of a globally unique identifier (the profile_id) and a relative item_id that can be repeated inside of the table but is unique in the context of a profile_id (For example customer_A and customer_X can both have a item with the id 0).
Here are my questions:
- Is it possible to index this composition of a globally unique key with a key that is unique within the scope of the globally unique one?
- Is there any performance hit or any possible complications?
- Is there a better way of solving this?
This is more of a conceptual problem.