Scan dynamodb table in sorted order based on a attribute

0 votes

I have a dynamo db table. I want the list of values returned and sorted based on an attribute. My question is do I need to create a global secondary index for this? If that is the case, what should be the hash key, what is the range key?

Apr 4, 2019 in AWS by Archana
• 5,640 points
22,591 views

1 answer to this question.

0 votes

If you are aware of the HashKey, then any query will return the items sorted by Range key. This is an extract form AWS Documentation:

"Query results are always sorted by the sort key value. If the data type of the sort key is Number, the results are returned in numeric order; otherwise, the results are returned in order of UTF-8 bytes. By default, the sort order is ascending. To reverse the order, set the ScanIndexForwardparameter to false."

So, i don't think its possible to order the results of scan

answered Apr 4, 2019 by datageek
• 3,090 points

Related Questions In AWS

0 votes
1 answer

Is there a limit on the number of attributes in DynamoDB Table?

Actually, there is no limit to the ...READ MORE

answered Feb 21, 2019 in AWS by Archana
• 5,640 points
4,410 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP