You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Niels Nuyttens <ni...@gmail.com> on 2011/03/19 16:53:51 UTC
Newbie question concerning schema design
Hi all,
I'm need a database scaled for large datasets and high throughput. HBase
seemed like the way to go. However, while designing my database schema I
started to doubt my choice, due to the conversion of the current
relational schema to a NoSQL variant. I can't get my head around the
efficient implementation of many-to-many relations.
For example: Users and Roles. How would you model that for HBase. I was
thinking about storing associated roles in a column of a user row, and
vice versa.
Furthermore there are lots of one-to-many relations that also need
converting.
So, in conclusion, my question is: is it possible to convert a
relation-oriented schema to a nosql one? If so, how can this modeling be
done efficiently?
Lots of thanks,
Niels
Re: Newbie question concerning schema design
Posted by Niels Nuyttens <ni...@gmail.com>.
Thank you both for your replies. I took a look at the information you
pointed me to, and it already helped me quite a lot.
For now, I still have these questions:
How do I deal with 'nested' one-to-one relationships? I'm
talking about a following case: a patient has many episodes
(concerning a certain treatment). These episodes have many
admissions (patient visiting the hospital).
A simplified version would be:
Patient[PK:AdremaNumber](name;last_name;sex;birthdate;...)
Episode[PK:episodeNumber](adremaNumber;admissionTime)
Admission[PK:PatientID](episodenumber;ward;bed;status;...)
LabResult[PK:labID](patientID;type;value;time;...)
PharmaOrder[PK:orderID](patientID;dose;unit;pharmaID;...)
Following the approach of both mailinglist and the paper by Ian
Varley, I got something like this:
table:patients| cf:information | cf:admissions |
------------------------------------------------------
RK:patient_id | -name | -admission1 |
| -age | -admission2 |
| ... | -... |
The id's for admissions would be made up as following:
episodenumber_patientID_admissionTime, while storing the little
bit of episode data within the rows of the admission table.
table:admissions | cf:information | cf:pharma | cf:labresults |
----------------------------------------------------------------------
RK:admission_id | -ward | -pharma1 | -result1
| -bed | -pharma2 | -result2
| ... | ... | ...
Does this seem like the way to go? I just find it hard to see
how I should model about five or six consecutive 1-to-many
relations...
Final question: a post by Michael Segel about the Pick-system
made me consider serializing data-objects and putting these in
HBase, rather than the values themselves as columns of a given
family.
In that case you could store a labresults-object as a whole
contained in a column of the admissions table.
I'm still dangling between these two approaches. Any wise words of you
connaisseurs would be most welcome...
Thank you so much,
Niels
On Sat, 2011-03-19 at 11:46 -0700, Stack wrote:
> There is also this small section in our book:
> http://hbase.apache.org/book/schema.html It refers to a useful paper
> by Ian Varley on modelling in non-rdbms dbs. Sounds like it would be
> good preparatory reading for the project you've just started.
>
> St.Ack
>
> On Sat, Mar 19, 2011 at 9:30 AM, Ted Yu <yu...@gmail.com> wrote:
> > See:
> > http://search-hadoop.com/m/zbKmE14o0Js/wide+tall+hbase+table&subj=Re+Parent+child+relation+go+vertical+horizontal+or+many+tables+
> >
> > You can also search for related discussion on tall vs. wide tables.
> >
> > On Sat, Mar 19, 2011 at 8:53 AM, Niels Nuyttens <ni...@gmail.com>wrote:
> >
> >> Hi all,
> >>
> >> I'm need a database scaled for large datasets and high throughput. HBase
> >> seemed like the way to go. However, while designing my database schema I
> >> started to doubt my choice, due to the conversion of the current
> >> relational schema to a NoSQL variant. I can't get my head around the
> >> efficient implementation of many-to-many relations.
> >>
> >> For example: Users and Roles. How would you model that for HBase. I was
> >> thinking about storing associated roles in a column of a user row, and
> >> vice versa.
> >>
> >> Furthermore there are lots of one-to-many relations that also need
> >> converting.
> >>
> >> So, in conclusion, my question is: is it possible to convert a
> >> relation-oriented schema to a nosql one? If so, how can this modeling be
> >> done efficiently?
> >>
> >> Lots of thanks,
> >>
> >> Niels
> >>
> >>
> >
Re: Newbie question concerning schema design
Posted by Stack <st...@duboce.net>.
There is also this small section in our book:
http://hbase.apache.org/book/schema.html It refers to a useful paper
by Ian Varley on modelling in non-rdbms dbs. Sounds like it would be
good preparatory reading for the project you've just started.
St.Ack
On Sat, Mar 19, 2011 at 9:30 AM, Ted Yu <yu...@gmail.com> wrote:
> See:
> http://search-hadoop.com/m/zbKmE14o0Js/wide+tall+hbase+table&subj=Re+Parent+child+relation+go+vertical+horizontal+or+many+tables+
>
> You can also search for related discussion on tall vs. wide tables.
>
> On Sat, Mar 19, 2011 at 8:53 AM, Niels Nuyttens <ni...@gmail.com>wrote:
>
>> Hi all,
>>
>> I'm need a database scaled for large datasets and high throughput. HBase
>> seemed like the way to go. However, while designing my database schema I
>> started to doubt my choice, due to the conversion of the current
>> relational schema to a NoSQL variant. I can't get my head around the
>> efficient implementation of many-to-many relations.
>>
>> For example: Users and Roles. How would you model that for HBase. I was
>> thinking about storing associated roles in a column of a user row, and
>> vice versa.
>>
>> Furthermore there are lots of one-to-many relations that also need
>> converting.
>>
>> So, in conclusion, my question is: is it possible to convert a
>> relation-oriented schema to a nosql one? If so, how can this modeling be
>> done efficiently?
>>
>> Lots of thanks,
>>
>> Niels
>>
>>
>
Re: Newbie question concerning schema design
Posted by Ted Yu <yu...@gmail.com>.
See:
http://search-hadoop.com/m/zbKmE14o0Js/wide+tall+hbase+table&subj=Re+Parent+child+relation+go+vertical+horizontal+or+many+tables+
You can also search for related discussion on tall vs. wide tables.
On Sat, Mar 19, 2011 at 8:53 AM, Niels Nuyttens <ni...@gmail.com>wrote:
> Hi all,
>
> I'm need a database scaled for large datasets and high throughput. HBase
> seemed like the way to go. However, while designing my database schema I
> started to doubt my choice, due to the conversion of the current
> relational schema to a NoSQL variant. I can't get my head around the
> efficient implementation of many-to-many relations.
>
> For example: Users and Roles. How would you model that for HBase. I was
> thinking about storing associated roles in a column of a user row, and
> vice versa.
>
> Furthermore there are lots of one-to-many relations that also need
> converting.
>
> So, in conclusion, my question is: is it possible to convert a
> relation-oriented schema to a nosql one? If so, how can this modeling be
> done efficiently?
>
> Lots of thanks,
>
> Niels
>
>