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
質問済み 1年前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
エキスパート
回答済み 1年前
profile pictureAWS
エキスパート
kentrad
レビュー済み 1年前
  • 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
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ