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
질문됨 일 년 전207회 조회
2개 답변
1
수락된 답변

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
전문가
답변함 일 년 전
profile pictureAWS
전문가
kentrad
검토됨 일 년 전
  • 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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인