Regarding AWS dynamodb

0

Hi,

I am working with 10 iot devices which sends data to IOT core and then store to dynamodb. I want to design web interface to display this data. Now in dynamodb, i have same partition key value and sort key value. now my question is data i receive in dynamodb will be sorted order?

Also suggest any way to handle data from multiple devices.

kushal
asked a year ago202 views
2 Answers
1
Accepted Answer

The data in DynamoDB will be sorted order by the sort key you have defined. Sorting is only applicable to items which share the same partition key. Lets take an example of a table where we sort data by time, time being the sort key (SK)

PKSK
sens-1012022-10-26T17:30:00.000-04:00
sens-1012022-10-27T17:30:00.000-04:00
sens-1012022-10-28T17:30:00.000-04:00
sens-1012022-11-21T17:30:00.000-04:00
sens-1012022-11-22T17:30:00.000-04:00
sens-1012022-12-01T17:30:00.000-04:00
sens-1072022-10-26T17:30:00.000-04:00
sens-1072022-10-27T17:30:00.000-04:00
sens-1072022-10-28T17:30:00.000-04:00
sens-1072022-11-21T17:30:00.000-04:00
sens-1072022-11-22T17:30:00.000-04:00
sens-1072022-12-01T17:30:00.000-04:00
sens-1032022-10-26T17:30:00.000-04:00
sens-1032022-10-27T17:30:00.000-04:00
sens-1032022-10-28T17:30:00.000-04:00
sens-1032022-11-21T17:30:00.000-04:00
sens-1032022-11-22T17:30:00.000-04:00
sens-1032022-12-01T17:30:00.000-04:00

Now you can see that each sensor data is sorted by the order of the sort key, but sorting is not across all sensors in the table.

profile pictureAWS
EXPERT
answered a year ago
profile pictureAWS
EXPERT
kentrad
reviewed a year ago
  • Hi,

    Thanks for your prompt response. I understood that we can sort data if we keep PK constant using sort key. As i said earlier, I have multiple devices which sends timeseries data to dynamodb. As a PK, I am using Device ID. As a sort key i am using a positive going number as it will sort out other attributes of data. I am not using time stamp as SK since in a single timestamp, multiple data is transmitted. due so, data get unordered.

    Lets say If we want history of data @ some perticular time, then what to do? How do we fetch historical data from dynamodb?

    Kindly note that data should be in order as they come from iot core.

    Also what if PK and SK are constant & data attributes are changing?

-1

can any body help me out in this or any suggestions?

kushal
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions