Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HBase one to many 'relationship' storage

Tags:

hbase

I'm pondering the best way to implement a one to many relationship in HBase.

Say an ACCOUNT has many TRANSACTION(s). Is it better to

a) Add columns to a transactions: column family on the ACCOUNT table, i.e. transactions:1:amount, transactions:2:amount

b) Only store the key(s) of each TRANSACTION relating to an account in in the transactions: column family of ACCOUNT, and do a lookup of each transaction found on a separate TRANSACTION table?

like image 656
AlexJReid Avatar asked Apr 14 '11 10:04

AlexJReid


1 Answers

Generally, option a, is the better approach.

This allows you to easily request all the transactions for an account at once. No additional lookup is needed, for each transaction.

There are use cases where option b may be appropriate, such as frequently running queries on all of the transactions.

like image 155
codingFoo Avatar answered Oct 12 '22 08:10

codingFoo