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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With