You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Ramasubramanian Narayanan <ra...@gmail.com> on 2012/12/24 08:46:12 UTC

Regarding Designing Hbase Table - for a banking scenario

Hi,

How to design Rowkey for Hbase table for one to many relationship....

For example, the below is the relational table, which should be converted
to single table in HBase

Table Name : Customer
Customer Number
DOB
FName
MName
LName
...
...
...

Table Name : Address *(a single customer can have multiple address)*
Customer Number
Address Line1
Address Line2
Address Line3
Address Line4
State
City
Country

My understanding :
All fields of "Customer" can be of one Column Family "F1"
All fields of "Address" can be of another Column Family "F2"

Questions:
1) Is the above column family grouping will be good?
2) What should he rowkey for this given situation?
3) In general can we design a rowkey w.r.t the row that we populate? for
example, for specific rows I may have Columns A+B+C constitue a rowkey, for
some other records IN THE SAME TABLE, column B+C+D can be used as a rowkey?

regards,
Rams

Re: Regarding Designing Hbase Table - for a banking scenario

Posted by Aaron Kimball <ak...@gmail.com>.
Hi Rams,

This schema looks like a pretty reasonable one. It's worth noting though,
that there are some performance implications of using multiple column
families like this for every 1:many relationship in raw HBase. Each column
family is expensive to maintain.

You might find it helpful to take a look at the KijiSchema project (
www.kiji.org). It's built on HBase and Avro, supports typed fields, and
also allows you to define arbitrary logical column families (and change
column types) in a safe, evolvable way.

Your row key schema looks pretty reasonable. You can manage your row keys
however you want in Kiji (just concatenate the strings as you'd like), but
we're thinking about adding direct support for composite keys to the system
as well.

Regards,
- Aaron


On Mon, Dec 24, 2012 at 2:10 AM, Mohammad Tariq <do...@gmail.com> wrote:

> Yes, you can. You just have to extract those fields in advance so that you
> constitute the rowkey before actually putting the data in that particular
> row. Also, try to keep your rowkeys as short as possible and if possible
> try to use byte[] as row keys.
>
> Best Regards,
> Tariq
> +91-9741563634
> https://mtariq.jux.com/
>
>
> On Mon, Dec 24, 2012 at 2:42 PM, Ramasubramanian Narayanan <
> ramasubramanian.narayanan@gmail.com> wrote:
>
> > Hi,
> > Thanks for your reply...
> > Could you please help in answering my 3rd question...
> >
> > regards,
> > Rams
> >
> > On Mon, Dec 24, 2012 at 1:23 PM, Mohammad Tariq <do...@gmail.com>
> > wrote:
> >
> > > design a rowkey w.r.t the row that we populate? for
> > > > example, for specific rows I may have Columns A+B+C constitue a
> rowkey,
> > > for
> > > > some other records IN THE SAME TABLE, column B+C+D can be used as a
> > > rowkey?
> > >
> >
>

Re: Regarding Designing Hbase Table - for a banking scenario

Posted by Mohammad Tariq <do...@gmail.com>.
Yes, you can. You just have to extract those fields in advance so that you
constitute the rowkey before actually putting the data in that particular
row. Also, try to keep your rowkeys as short as possible and if possible
try to use byte[] as row keys.

Best Regards,
Tariq
+91-9741563634
https://mtariq.jux.com/


On Mon, Dec 24, 2012 at 2:42 PM, Ramasubramanian Narayanan <
ramasubramanian.narayanan@gmail.com> wrote:

> Hi,
> Thanks for your reply...
> Could you please help in answering my 3rd question...
>
> regards,
> Rams
>
> On Mon, Dec 24, 2012 at 1:23 PM, Mohammad Tariq <do...@gmail.com>
> wrote:
>
> > design a rowkey w.r.t the row that we populate? for
> > > example, for specific rows I may have Columns A+B+C constitue a rowkey,
> > for
> > > some other records IN THE SAME TABLE, column B+C+D can be used as a
> > rowkey?
> >
>

Re: Regarding Designing Hbase Table - for a banking scenario

Posted by Ramasubramanian Narayanan <ra...@gmail.com>.
Hi,
Thanks for your reply...
Could you please help in answering my 3rd question...

regards,
Rams

On Mon, Dec 24, 2012 at 1:23 PM, Mohammad Tariq <do...@gmail.com> wrote:

> design a rowkey w.r.t the row that we populate? for
> > example, for specific rows I may have Columns A+B+C constitue a rowkey,
> for
> > some other records IN THE SAME TABLE, column B+C+D can be used as a
> rowkey?
>

Re: Regarding Designing Hbase Table - for a banking scenario

Posted by Mohammad Tariq <do...@gmail.com>.
Hello Ram,

         You schema looks fine to me.

And, you can have anything as your rowkey, but keeping in mind the types of
queries which your table is going to serve. It would be helpful for us to
answer your question in a better manner if can tell us what kind of queries
you face mostly? Thank you.

Best Regards,
Tariq
+91-9741563634
https://mtariq.jux.com/


On Mon, Dec 24, 2012 at 1:16 PM, Ramasubramanian Narayanan <
ramasubramanian.narayanan@gmail.com> wrote:

> Hi,
>
> How to design Rowkey for Hbase table for one to many relationship....
>
> For example, the below is the relational table, which should be converted
> to single table in HBase
>
> Table Name : Customer
> Customer Number
> DOB
> FName
> MName
> LName
> ...
> ...
> ...
>
> Table Name : Address *(a single customer can have multiple address)*
> Customer Number
> Address Line1
> Address Line2
> Address Line3
> Address Line4
> State
> City
> Country
>
> My understanding :
> All fields of "Customer" can be of one Column Family "F1"
> All fields of "Address" can be of another Column Family "F2"
>
> Questions:
> 1) Is the above column family grouping will be good?
> 2) What should he rowkey for this given situation?
> 3) In general can we design a rowkey w.r.t the row that we populate? for
> example, for specific rows I may have Columns A+B+C constitue a rowkey, for
> some other records IN THE SAME TABLE, column B+C+D can be used as a rowkey?
>
> regards,
> Rams
>