How to get unique column values ​​in AWS Dynamo?

Let's say in AWS Dynamo I have a table like this:

ID (HKey) Date (RKey) BoxName 0 1/1/2014 Box-1 1 2/1/2014 Box-1 2 3/1/2014 Box-2 3 4/1/2014 Box-3 4 5/1/2014 Box-3 5 5/1/2014 Box-1 

I want in one request to get the first row for each unique block. There may be hundreds of mailboxes, I need the first record right away, which makes individual queries ineffective.

I can not find anything in the API that would allow me to do this. Is it possible? How can I do it?

+5
source share
1 answer

You might want to create a global secondary index (GSI) in the Name field (hash key) and the date as a range key. This will allow you to use the query API in the secondary index, where you can query "Find all identifiers with the field" Field name "= $).

See the documentation for GSI .

Hope this helps, Swami

+2
source

Source: https://habr.com/ru/post/1201603/


All Articles