OiO.lk Blog java Fetching min records for PK without using scan
java

Fetching min records for PK without using scan


I am new developer in Dynamo and I am trying to build a query in dynamo to get each registry with the min value of the number of retries for the PK. For example, in the following data set, I want to get the registry with sk 87bee31f-03da-42f3-92ec-5b8e5e1e726f and registry with sk 87bee31f-03da-42f3-92ec-5b8e5e1e746f.I understand that it is not possible to aggregate in Dynamo and that running the scan is expensive and the performance is not the best. However, for this query I don’t know PK’s and I haven’t found any other way to do this. What is the best way to build this query? It is posssible without scan?

pk=1, sk=87bee31f-03da-42f3-92ec-5b8e5e1e726f, retries=0
pk=1, sk=87bee31f-03da-42f3-92ec-5b8e5e1e727f, retries=2
pk=2, sk=87bee31f-03da-42f3-92ec-5b8e5e1e718f, retries=3
pk=2, sk=87bee31f-03da-42f3-92ec-5b8e5e1e739f, retries=4
pk=2, sk=87bee31f-03da-42f3-92ec-5b8e5e1e746f, retries=1
pk=2, sk=87bee31f-03da-42f3-92ec-5b8e5e1e757f, retries=2
pk=1, sk=87bee31f-03da-42f3-92ec-5b8e5e1e728f, retries=3
pk=1, sk=87bee31f-03da-42f3-92ec-5b8e5e1e729f, retries=4



You need to sign in to view this answers

Exit mobile version