I read / studied HBase and tried to create a circuit. I am from the RDBMS database and this is the first time you are trying to run nosql db. I have a simple question about circuit design:
Suppose there are three tables => album, photo, comment
- album <= Created by
- photo <= Contains all the photos uploaded to the album
comments <= Contains commenrs on an album or photo
The photo should be taken taking into account all comments. The album must be uploaded with all the photos in it, but not with comments.
user is identified by email. The scheme I came across:
tbl_user
email || info: {password : ..., name : ...}
album
<email>:album:<timestamp> || info {title:..., cover: photo-row-key}
Photo
<album-row-key>:<timestamp> || info {caption:..., exif: ...}
A comment
<album-row-key or photo-row-key> || comments { comment:<timestamp>: {user: <email>, text:...} comment:<timestamp>: {user: <email>, text:...} comment:<timestamp>: {user: <email>, text:...} ... }
- Does this design all right? I just want to know the changes that should / should be made and why.
- If the photo-line key is not added by the line-album keys (possibly to save space)?
- Regarding the comment table, should I create a comment string key as
<album-row-key or photo-row-key>:comment:<timestamp> ? According to the above diagram, whenever a user creates a comment, I need to read the comment column, update it with a new comment and update the line with tha. Does this sound normal?
It will be very useful if you could share some links (links) that have / have examples of schemes that are more suitable for a DBMS :)
source share