I'm want redesign a exist table which is contains two columns uuid
and consumerId
. In this stage, distinct uuid has 50 amounts and consumerId for every uuid more then 100k.
So, is it reasonable create 50 tables and named with uuid, such as consumerId_{uuid001}
to avoid redundancy caused by uuid
column?
First of all you need to think of use cases of how you going to use this database.
Do you need to find each all uuid
s for specific consumerId
?
With design that you propose it means that you’ll need to query 50 different tables and then unite results which is not an easy task at all.
I would go with one of the following options:
uuid
s by consumerId
and vice verse quite easily. I don’t see a problem of having extra 100k integers it’s just couple kilobytes.consumerId
s are stored in a list for each uuid
. Pseudocode: table(uuid: String, consumerId: List<String>)
This will definitely be compact representation, but you might struggle build some type of queries (where consumerId
is one of parameters).