DynamoDB Queries
- Allow you to find items using only primary key values from table or secondary index
- Benefits:
- Returns the item matching the primary key search
- Much more efficiency because it searches indexes only
- Returns all attributes of an item, or only the ones you want
- Is eventually consistent by default but can request a consistent read
- Can use conditional operators and filters to return precise results
DynamoDB Scans
- Reads every item in the table and is operationally inefficient
- Looks for all items and attributes in a table by default
- Benefits;
- Scans can apply filters to the results to refine vaules
- Can return only specific attributes with the ProjectionExpression parameter
- Negatives:
- The larger the data set in the table the slower performance of a scan
- The more filters on the scan the slower the performance
- Returns only filtered results
- Only eventually consistent reads are available
DynamoDB Scans – If you must use them
- What you should keep in mind:
- You can reduce Page Size of an operation with the Limit parameter, to limit how much data you try to retrieve at the same time
- Avoid performing Scans on mission-critical tables
- Program your application logic to retry any requests that recieves a response code saying that you exceeded provisioned throughput (or increase throughput)