Is Reservation System Suitable for Amazon DynamoDB

2019-08-12 01:28发布

I'm working on basic restaurant reservation system and was thinking about using Amazon DynamoDB for this project. That being said, I'm not even sure if DynamoDB is suitable for something like this or if I should stick to MySQL RDS since some of the queries may be quite complex.

Functionality I need:

User will submit a "Find Table" form with date, time and party size.

  1. Check RESTAURANT table if date and party size is even allowed.
  2. Check BLOCKED table for blocked dates (holidays and other closures)
  3. Check HOURS table making sure the restaurant is even open.
  4. Check TABLEINFO table for a table based on party size AND compare with RESERVATION table making sure the table is not already reserved for another guest during the same time

Any suggestions or tips on the DynamoDB database design especially hash & range use for something like this?

Or do you think MySQL database is better suited for this kind of app?

This is a quick DB design to give you better idea what I'm trying to do.

Reservation Schema

1条回答
Bombasti
2楼-- · 2019-08-12 01:46

I've done a lot with relational databases, and a bit with NoSQL databases (just so you know where I'm coming from). IMHO, NoSQL databases are best suited to scenarios where either one or more are true:

  1. The data is essentially flat (not a lot of relations, almost like an old flat-file)
  2. There's a definite "parent" type record with "child" records which are small enough/accessed frequently enough with the parent to justify embedding them right in the record.
  3. You need the freedom to add/populate fields within reason. I like to think of it like inheritance, where every item in the table shares some common traits (ID, Name), but different records might have different traits. For example, an online product catalog might have books, bikes, and MP3 songs in it. A record for a "book" item would have stuff like ISBN, number of pages, author, etc. A "bike" might have wheel size and color, and an "MP3" would have length, artist, genre, etc. You'd never get all of those things in an "item" table in an RDS without some serious overloading or leaving fields empty. A NoSQL database would allow you to store all of that info in the table, and only for the items that need it.

You can definitely build the schema you include with your question using the indexing abilities of Dynamo, but you'd be trying to make a NoSQL database act like a RDS.

That said: I myself would try it with Dynamo first as a learning experience. :)

查看更多
登录 后发表回答