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
preguntada hace un año206 visualizaciones
2 Respuestas
1
Respuesta aceptada

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
EXPERTO
respondido hace un año
profile pictureAWS
EXPERTO
kentrad
revisado hace un año
  • 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
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas