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

190
Views
Dynamo DB - Find the most recent entry for each primary key

I have a dynamoDB table where I have a primary key of "email" and a sort key of "timestamp" For audit purposes I dont have any editing or deletion, only insert. However what I now want is a query to select all users (emails) but only the most recent version of that primary key. Is this possible? I have tried to loop over every email and run a query to select based on primary key and limiting to 1 however my lambda quickly timed out and failed.

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

0

You need to issue n-many queries for n-many PKs, given your data model.

You can create a GSI and have a new attribute Latest as its PK and the ID as the SK and do a query against that and retrieve everything with one Query.

Make it a sparse index so you only populate Latest with a value if it is the latest.

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!