Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D3355CF45 for ; Tue, 29 May 2012 10:40:11 +0000 (UTC) Received: (qmail 14175 invoked by uid 500); 29 May 2012 10:40:10 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 14088 invoked by uid 500); 29 May 2012 10:40:09 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 14071 invoked by uid 99); 29 May 2012 10:40:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 10:40:09 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of michael_segel@hotmail.com designates 65.55.111.88 as permitted sender) Received: from [65.55.111.88] (HELO blu0-omc2-s13.blu0.hotmail.com) (65.55.111.88) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 10:40:02 +0000 Received: from BLU0-SMTP249 ([65.55.111.71]) by blu0-omc2-s13.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 29 May 2012 03:39:41 -0700 X-Originating-IP: [173.15.87.37] X-Originating-Email: [michael_segel@hotmail.com] Message-ID: Received: from [192.168.0.101] ([173.15.87.37]) by BLU0-SMTP249.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 29 May 2012 03:39:39 -0700 Subject: Re: HBase (BigTable) many to many with students and courses References: <4FC3BAD6.4060005@yahoo.de> From: Michel Segel Content-Type: text/plain; charset="us-ascii" X-Mailer: iPad Mail (9B206) In-Reply-To: <4FC3BAD6.4060005@yahoo.de> Date: Tue, 29 May 2012 05:39:39 -0500 To: "user@hbase.apache.org" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 (1.0) X-OriginalArrivalTime: 29 May 2012 10:39:39.0564 (UTC) FILETIME=[5988F6C0:01CD3D87] X-Virus-Checked: Checked by ClamAV on apache.org Depends... Try looking at a hierarchical model rather than a relational model... One thing to remember is that joins are expensive in HBase. Sent from a remote device. Please excuse any typos... Mike Segel On May 28, 2012, at 12:50 PM, Em wrote: > Hello list, > > I have some time now to try out HBase and want to use it for a private > project. > > Questions like "How to I transfer one-to-many or many-to-many relations > from my RDBMS's schema to HBase?" seem to be common. > > I hope we can throw all the best practices that are out there in this > thread. > > As the wiki states: > One should create two tables. > One for students, another for courses. > > Within the students' table, one should add one column per selected > course with the course_id besides some columns for the student itself > (name, birthday, sex etc.). > > On the other hand one fills the courses table with one column per > student_id besides some columns which describe the course itself (name, > teacher, begin, end, year, location etc.). > > So far, so good. > > How do I access these tables efficiently? > > A common case would be to show all courses per student. > > To do so, one has to access the student-table and get all the student's > courses-columns. > Let's say their names are prefixed ids. One has to remove the prefix and > then one accesses the courses-table to get all the courses and their > metadata (name, teacher, location etc.). > > How do I do this kind of operation efficiently? > The naive and brute force approach seems to be using a Get-object per > course and fetch the neccessary data. > Another approach seems to be using the HTable-class and unleash the > power of "multigets" by using the batch()-method. > > All of the information above is theoretically, since I did not used it > in code (I currently learn more about the fundamentals of HBase). > > That's why I give the question to you: How do you do this kind of > operation by using HBase? > > Kind regards, > Em >