1

First time building a single table design and was just wondering if anyone had any advice/feedback/better ways on the following plan?

Going to be building a basic 'meetup' clone. so e.g. Users can create events, and then users can attend those events essentially.

How the entities in the app relate to eachother:

Entities: (Also added an 'ItemType' to each entity) so e.g. ItemType=Event

ERD

Key Structure: Key Structure

Access Patterns:

  1. Get All Attendees for an event

  2. Get All events for a specific user

  3. Get all events

  4. Get a single event

Global Secondary Indexes:

  1. Inverted Index: SK-PK-index

  2. ItemType-SK-Index

Queries: 1. Get all attendees for an event: PK=EVENT#E1

SK=ATTENDEE# (begins with)

2. Get All Events for a specific User

Index: SK-PK-index

SK=ATTENDEE#User1

PK=EVENT# (Begins With)

3. Get All Events (I feel like there's a much better way to do this, if there is please let me know)

Index: ItemType-SK-Index

ItemType=Event

SK=EVENT# (Begins With)

4. Get a single event

PK=EVENT#E1

SK=EVENT#E1

A couple of questions I had:

  1. When returning a list of attendees, I'd want to be able to get extra data for that attendee, e.g. First/Lastname etc.

Based on this example: https://aws.amazon.com/getting-started/hands-on/design-a-database-for-a-mobile-app-with-dynamodb/module-5/

To avoid having to duplicate data and handle when data changes, (e.g. user changes name) use Partial Normalization and the BatchGetItem API to retrieve details?

  1. For fuzzy searches etc, is the best approach to stream this data into e.g. elastic/opensearch?

If so, when building API's - would you still use dynamoDB for some queries, or just use elasticsearch for everything?

  1. e.g. for Get All Events - would using an ItemType of 'Events' end up creating a hot partition if there's a huge number of events?

Sorry for the long post, Would appreciate any feedback/advice/better ways to do things, thank you!!

JS-Dev
  • 51
  • 4
  • Your database is clearly relational with a fixed schema. Why do you want to use DynamoDB which is non-relational and schemaless? – Marcin Dec 03 '21 at 06:26
  • Then I would suggest reading up about no-SQL and relational databases. The fact that you have the relational schematic in your question, indicates that dynamodb is not the right tool for your use-case. – Marcin Dec 03 '21 at 06:55
  • 1
    @JS-Dev This might help you https://stackoverflow.com/a/68612022/4018264 – Libu Mathew Dec 04 '21 at 20:28
  • @Marcin, that is 100% not true. Just because data is relational does not mean it cannot go into a DynamoDB database. What info we are missing from the OP that would help determine which DB to use, is the velocity of the requests and what data is necessary when in this application. The fixed schema part is not a reason either. Also, DynamoDB is not schemaless. You must have a primary key thus it has a schema, just that it is flexible. If you mean it does not enforce a schema, then you'd be correct. – NoSQLKnowHow Dec 07 '21 at 08:18

0 Answers0