One way to do it would be to drop the sales_id and use a composite key of
user_id/product_id (assuming that a user may only by one product). Then you
could do a simple get("xyz/123") to get the full row. If you wanted to get the
email of people who bought product "123", then a row key of product/user might
be more useful. Then you could scan starting at "123", ending at "123\0".
However, you need to ask the question: Since you already have an RDBMS that
works, why do you want to switch to HBase? If it is because you have a lot of
transaction data (really? Main memory is getting pretty big these days...),
maybe you want to store user info in the RDBMS and just the transaction data in
HBase.
Dave
-----Original Message-----
From: Stuti Awasthi [mailto:[email protected]]
Sent: Wednesday, August 17, 2011 8:19 AM
To: [email protected]
Subject: Hbase query
Hi all
I have read that Hbase query will depend on <Row-Key> only . I was trying to
map my tables of RDBMS to HBASE and was thinking way out for the following ?
RDBMS Schema :
Table Sales
Column:
* Sales_Id (PK)
* User_Id (FK)
* Product_ID (FK)
* Name
* Mobile
* Email
Query : Select Name , Mobile, Email from Sales where User_id= "xyz" and
Product_Id= "123"
This query is fairly simple in RDBMS because we can query based on columns. How
to do this efficiently in Hbase ?
________________________________
::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates.
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------