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
gefragt vor einem Jahr207 Aufrufe
2 Antworten
1
Akzeptierte Antwort

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
EXPERTE
beantwortet vor einem Jahr
profile pictureAWS
EXPERTE
kentrad
überprüft vor einem Jahr
  • 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
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen