You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Stuti Awasthi <st...@hcl.com> on 2011/08/16 18:18:17 UTC

Hbase Schema Query

Hi Friends,

I am currently trying to understand the schema design of Hbase. I have a scenario like this :

RDBMS Table and Columns detail:


1)      Table : User

*         User_Id

*         User_name

2)      Table : Test

*         Test_Id

*         Test_name

*         User_Id

So here User_ID is being used as a Foreign key in table Test. I can think to map it to Hbase schema like as shown below : In this case both User_Id and Test_Id have many to many relationship.

Table

Row

Column Family

Column Qualifier

User

User_Id

Info

User_Name





Test

<Test_Id>











Test_Id

Info

Test_name





Test

<User_Id>



I want to know that is there any better way to design this schema ? Please suggest

Thanks & Regards
Stuti Awasthi
Sr Specialist


________________________________
::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.

-----------------------------------------------------------------------------------------------------------------------

RE: Hbase Schema Query

Posted by Stuti Awasthi <st...@hcl.com>.
Hi,

I am formatting the Hbase Schema again for better understanding :

RDBMS Table and Columns detail:

Table : User 
	User_Id	User_name

Table : Test
	Test_Id  	Test_name	User_Id

So here User_ID is being used as a Foreign key in table Test. I can think to map it to Hbase schema like as shown below : In this case both User_Id and Test_Id have many to many relationship.

Table  		Row		Column Family			Column Qualifier

User		User_id	info				name
				Test				<test_id>
 

		Test_id		info				name
				User				<user_id>


Now by this design I can query different test associated with 1 User_id and vice-versa.

Regards
Stuti




-----Original Message-----
From: jdcryans@gmail.com [mailto:jdcryans@gmail.com] On Behalf Of Jean-Daniel Cryans
Sent: Tuesday, August 16, 2011 10:43 PM
To: user@hbase.apache.org
Subject: Re: Hbase Schema Query

This would be solved like any secondary index problems, so I would recommend that you read:
http://hbase.apache.org/book/secondary.indexes.html

Also the HBase schema you posted didn't come across well, you might want to review the formatting.

Finally, the most important thing to take into account when designing HBase schemas is your query pattern(s). Without that, any schema is as bad as any other. Since you didn't provide that, we can't be of any useful help.

J-D

On Tue, Aug 16, 2011 at 9:18 AM, Stuti Awasthi <st...@hcl.com> wrote:
> Hi Friends,
>
> I am currently trying to understand the schema design of Hbase. I have a scenario like this :
>
> RDBMS Table and Columns detail:
>
>
> 1)      Table : User
>
> *         User_Id
>
> *         User_name
>
> 2)      Table : Test
>
> *         Test_Id
>
> *         Test_name
>
> *         User_Id
>
> So here User_ID is being used as a Foreign key in table Test. I can think to map it to Hbase schema like as shown below : In this case both User_Id and Test_Id have many to many relationship.
>
> Table
>
> Row
>
> Column Family
>
> Column Qualifier
>
> User
>
> User_Id
>
> Info
>
> User_Name
>
>
>
>
>
> Test
>
> <Test_Id>
>
>
>
>
>
>
>
>
>
>
>
> Test_Id
>
> Info
>
> Test_name
>
>
>
>
>
> Test
>
> <User_Id>
>
>
>
> I want to know that is there any better way to design this schema ? 
> Please suggest
>
> Thanks & Regards
> Stuti Awasthi
> Sr Specialist
>
>
> ________________________________
> ::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.
>
> ----------------------------------------------------------------------
> -------------------------------------------------
>

Re: Hbase Schema Query

Posted by Jean-Daniel Cryans <jd...@apache.org>.
This would be solved like any secondary index problems, so I would
recommend that you read:
http://hbase.apache.org/book/secondary.indexes.html

Also the HBase schema you posted didn't come across well, you might
want to review the formatting.

Finally, the most important thing to take into account when designing
HBase schemas is your query pattern(s). Without that, any schema is as
bad as any other. Since you didn't provide that, we can't be of any
useful help.

J-D

On Tue, Aug 16, 2011 at 9:18 AM, Stuti Awasthi <st...@hcl.com> wrote:
> Hi Friends,
>
> I am currently trying to understand the schema design of Hbase. I have a scenario like this :
>
> RDBMS Table and Columns detail:
>
>
> 1)      Table : User
>
> *         User_Id
>
> *         User_name
>
> 2)      Table : Test
>
> *         Test_Id
>
> *         Test_name
>
> *         User_Id
>
> So here User_ID is being used as a Foreign key in table Test. I can think to map it to Hbase schema like as shown below : In this case both User_Id and Test_Id have many to many relationship.
>
> Table
>
> Row
>
> Column Family
>
> Column Qualifier
>
> User
>
> User_Id
>
> Info
>
> User_Name
>
>
>
>
>
> Test
>
> <Test_Id>
>
>
>
>
>
>
>
>
>
>
>
> Test_Id
>
> Info
>
> Test_name
>
>
>
>
>
> Test
>
> <User_Id>
>
>
>
> I want to know that is there any better way to design this schema ? Please suggest
>
> Thanks & Regards
> Stuti Awasthi
> Sr Specialist
>
>
> ________________________________
> ::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.
>
> -----------------------------------------------------------------------------------------------------------------------
>