Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
How to Implement sorting in REST API with DynamoDB

I am trying to implement pagination + sorting of records in my rest API using dynamodb.

There are 4 attributes in the table:-

  • a - pk ( partition key)
  • b - SK (range key)
  • createdAt - normal attribute
  • updatedAt - normal attribute

Since dynamodb always sorts data by default on the range key. This will be a problem when I would like to sort based on created or updated with pagination as some data will be on page 1 for 2020 and 2021 years and some data on page 2 will be of 2022 and 2020 if the range key item starts with z ( just an example)

is there any workaround for this where we can sort dynamic data with pagination and other attributes that are not range key? Also i dont want to use index for the attributes as it can ensure cost

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you want to search more indices, you must create more indices. It sounds like you need local secondary indices on updated and created. Then when you sort by that, you switch your pagination to using the correct index.

And I understand that you don't want to pay, but that cost is precisely for what you seek, as far as I can tell.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!