Search code examples
amazon-dynamodb

Saving data efficiently in dynamoDB table


I have dynamoDB structure like this:

id: 9819938466
dt: 230822063230
code: 22

ID is 10 digit mobile number treated as username.

DT is current date + Time

CODE is the actual value that I need to store.

I expect about a few thousand unique ID's to record their code. The total number of rows will not be more than a million. Is my table structure as per industry standard?


Solution

  • Yes, you don't state what is your partition and sort key, but my guess is that ID is your partition key and DT is your sort key. This will allow you to fetch all the codes for a given user in a given time range efficiently and is your best data model.