1

I've been going through AWS DynamoDB docs and cannot figure out what's the difference between batchGetItem() and Query().

My use case: I have a table which has Id as primary hash key, and attribute values are Name and Marks. I would like to perform batch query which returns list of names and marks by providing list of Id's which are primary keys.

Should I use batchGetItem() or Query()?

devil
  • 33
  • 6
  • 1
    possible duplicate of [What's the difference between BatchGetItem and Query in DynamoDB?](http://stackoverflow.com/questions/30749560/whats-the-difference-between-batchgetitem-and-query-in-dynamodb) – Mircea Jul 13 '15 at 15:50

1 Answers1

0

BatchGetItem: Allows to you parallelize "GetItem" requests for languages that don't support parallelism (i.e. javascript). This includes retrieving items from different tables (doesn't support indexes though).

Query: Allows you to page through tables with a Hash-Range schema (where you'll have multiple results associated with a Hash key) and allows you to retrieve items from the indexes on your table. Note you can also add an additional condition on range key in your KeyConditions and add conditions on any non primary key attribute in your QueryFilter.

It seems like that your use case calls for a BatchGetItem request, as you are trying to retrieve items from your base table by way of a Hash key.

Hope that helps!

Raymond Lin
  • 491
  • 2
  • 5