Sudha Shankar Kj
Sudha Shankar Kj

Reputation: 1

How can I get sorted results from DynamoDB without Sort Key?

I created a dynamoDB and I did not create a sort Key at the time of creation. I now want to get the results sorted based on a particular attribute of the table. I figured out that the sort key cannot be added to an already existing table.

Is there some other way that I can query the results sorted?

Upvotes: 0

Views: 2497

Answers (1)

Seth Geoghegan
Seth Geoghegan

Reputation: 5747

If you do not have a sort key, your options will be limited to one of the following choices:

  1. Create a global secondary index that has a sort key.
  2. Perform the sorting operation in your application code.

The second option may give you trouble if your data is paginated. With a sort key in place, paginated results would be returned in sort order. If you're doing sorting entirely within your application code, you'd need to account for this.

Upvotes: 1

Related Questions