DynamoDB Scan VS Query VS Put

Yogita Misal
2 min readApr 17, 2024

--

DynamoDB scan :

  1. It is function to retrives all items in your table similar to mysql select * from tablename.
  2. It filter down results with Filterexpressions.
  3. Its very expensive and should be avoidable in production apps.
  4. Supports parallel scans using multi-threading
  5. It can return only 1 MB of worth of the data per call, extra data needs to paginations.

Query :

  1. Queries allows you to retrive data with a partition key + range key.
  2. Use RangeKey’s condition expressions to further narrow results.
  3. You can also query on Global secondary indexes.
  4. It has much better performance than scan as O(1).
  5. Its cost effective but may require careful thought of your schema.

When to use what ?

Scan : No

Query: Many records and more conditions.

GetItem: Specific key and more efficinecy.

Can put method can push 38k of records?

The put method in DynamoDB can indeed handle inserting a large number of records, including 38,000 records. However, there are a few considerations to keep in mind:

  1. Item Size Limit: Each item you insert into DynamoDB must not exceed 400 KB in size. If you’re inserting a large number of records, ensure that each individual record does not exceed this size limit.
  2. Provisioned Throughput: DynamoDB has provisioned throughput limits, which include both read and write capacity units. If you’re inserting a large number of records, you need to ensure that your table has sufficient write capacity units to handle the write throughput required for the number of records you’re inserting.
  3. Batch Writes: To efficiently insert a large number of records, you can use the BatchWriteItem operation instead of individual put requests. This allows you to write multiple items to one or more tables in a single request, reducing the number of API calls required and potentially improving performance.
  4. Backoff and Retry Logic: When performing large-scale writes, it’s important to implement appropriate backoff and retry logic to handle throttling and other transient errors that may occur.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Yogita Misal
Yogita Misal

No responses yet

Write a response