amazon-dynamodbdatabase-partitioning

How to get the set of the items by id with pagination in dynamodb


I have a table Topic, with multiple topics with topicId as primary key and updatedTime as sort key.

I can able to fetch single topic by topicId, but my requirement is to fetch more than 1 topics by id and also I need pagination.

Can you please suggest if I need to use GSI or change schema to achieve it efficiently.


Solution

  • No your design is fine, you just need to use Query API call.

    And you can paginate the results if needed. Learn more here

    If you need to obtain many orders with a single request then you can use ExecuteStatement which allows you to search for up to 50 partition keys in a single request. You can paginate just as you would with the low level Query, except using PartiQL it'll be specified on the WHERE clause.