Advanced queries in HBase
Posted
by Teflon Ted
on Stack Overflow
See other posts from Stack Overflow
or by Teflon Ted
Published on 2009-09-16T23:50:40Z
Indexed on
2010/05/22
11:20 UTC
Read the original article
Hit count: 239
Given the following HBase schema scenario (from the official FAQ)...
How would you design an Hbase table for many-to-many association between two entities, for example Student and Course?
I would define two tables:
Student: student id student data (name, address, ...) courses (use course ids as column qualifiers here)
Course: course id course data (name, syllabus, ...) students (use student ids as column qualifiers here)
This schema gives you fast access to the queries, show all classes for a student (student table, courses family), or all students for a class (courses table, students family).
How would you satisfy the request: "Give me all the students that share at least two courses in common"? Can you build a "query" in HBase that will return that set, or do you have to retrieve all the pertinent data and crunch it yourself in code?
© Stack Overflow or respective owner