1

I am new to DynamoDB, can anyone help me using JOIN in DynamoDB? I use Serverless framework and mapping-template. I have table with POST and USER. POST has userId field. How I can get all posts with info about user ? In MYSQL I can use JOIN but how it work in DynamoDB ? I read posts in stackoverflow created 2 years ago. And guys wrote that it is not available. Maybe something had changed ... ?

Volodymyr Zh
  • 317
  • 7
  • 19
  • 2
    DynamoDB is not a relational database like MySQL is: https://stackoverflow.com/questions/36753861/how-to-join-tables-in-aws-dynamodb – Seanvm Jul 09 '18 at 21:19

3 Answers3

12

DynamoDB is a NoSQL Database. This gives it partitioning, incredible performance, scalability, reliability, etc.

The trade-off is that it is not a relational database. Therefore, DynamoDB will not perform a table join.

You will need to read the tables separately and 'join' desired data within your application.

For example, retrieve the UserId from your Post table, then retrieve records from the User table for the given UserId.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
0

I found solution. User @eltonio450 on gitHub showed how to do this.

Volodymyr Zh
  • 317
  • 7
  • 19
0

Technically, you could use Amazon EMR Hadoop to create an EXTERNAL Hive table on top of a DynamoDB table; then query the Hive table using HiveQL.

However, the Hive + DynamoDB approach is not recommended; since DynamoDB is designed for low-latency queries. Hive is batch-oriented.

Additionally, Hive might issue a scan (intrinsically inefficient) request to the DynamoDB table(s) before applying any query predicate(s).

k0L1081
  • 159
  • 1
  • 4