Search code examples
hbase

Is hbase create table is lightweight?


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?


Solution

  • 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 uuids 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:

    1. leave as is - it’s the most flexible way you’ll be able to query all uuids by consumerId and vice verse quite easily. I don’t see a problem of having extra 100k integers it’s just couple kilobytes.
    2. Modify structure so consumerIds 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).