Cohort 4Register
Data Engineering Interviews

DynamoDB Interview Questions and Answers for Data Engineers (2026)

DynamoDB interviews test whether you design a table around how it will be read: partition and sort keys, GSI against LSI, capacity modes, hot partitions, Streams, TTL and transactions. Twenty-two questions with answers checked against the AWS documentation, plus the scenario rounds.

By Durgesh Yadav — Senior Data Engineer @ 7-Eleven · Updated 25 Nov 2026. Preparation guidance, not a hiring guarantee.

Jump to 22 answered questionsBeginner to Advanced · 4 FAQs · 4-part guide

What questions are asked in a DynamoDB interview?

DynamoDB rounds test table design for known read patterns: how the partition key spreads data and what the sort key adds, GSI against LSI, Query against Scan, on-demand against provisioned capacity, and how to avoid a hot partition (one partition serves at most 3,000 read and 1,000 write units). Data roles add Streams for change data capture, TTL and transactions.

Guide

What To Learn And How To Practice

What do DynamoDB interviewers actually test?

Whether you start from the access patterns. A relational schema is designed first and queried any way later; a DynamoDB table is designed from the list of reads it must serve, because a Query needs one exact partition key value and anything else means an index or a Scan. Expect to state an item's key, say which index serves each read, and explain what happens to throughput when one key gets most of the traffic.

Keys: partition key for distribution, sort key for order and ranges
Indexes: when a GSI, when an LSI, and what each costs
Throughput: capacity modes, per-partition limits, throttling
Data engineering: Streams, TTL, exports to S3 and transactions

GSI vs LSI: what is the difference?

A GSI gives the data a new partition key; an LSI keeps the partition key and gives it a new sort order. The rest of the differences follow from that, and interviewers ask for them in this order.

Global and local secondary indexes, from the AWS documentation
DimensionGlobal secondary index (GSI)Local secondary index (LSI)
KeyIts own partition key, optional sort keyThe table's partition key, a different sort key
When you create itWith the table or later, one per UpdateTable callOnly with the table, in CreateTable
How many per tableUp to 20 by default (AWS can raise it)Up to 5
Read consistencyEventually consistent onlyEventually or strongly consistent
ThroughputIts own capacity on a provisioned tableShares the table's capacity
Size limitNone per key10 GB per partition key value, table and indexes together

DynamoDB interview questions and answers: the ones that decide the round

Short answers to the questions that come up first. The question bank below answers all twenty-two in full.

Partition key or sort key?

The partition key decides which partition stores the item; items sharing it are kept together, ordered by the sort key. Query needs one exact partition key value and can filter the sort key by range or prefix.

Query or Scan?

Query reads one partition key's items; Scan reads the whole table. A filter on a Scan is applied after the read, so it saves no capacity. Both return at most 1 MB per call.

On-demand or provisioned?

On-demand is pay-per-request for spiky or unknown traffic; provisioned sets read and write units, with auto scaling if you want it, for traffic you can forecast.

Hot partition

One key taking most of the traffic. A partition serves at most 3,000 read and 1,000 write units, so spread the load with high-cardinality keys or write sharding.

Streams

A time-ordered log of item changes kept for 24 hours, each record exactly once and in order per item. The usual route for change data capture into S3.

TTL

Set an expiry time in Unix epoch seconds on each item; DynamoDB deletes expired items, typically within a few days, without using write capacity. Filter expired items out of reads until then.

Transactions

TransactWriteItems: up to 100 actions on up to 100 items, at most 4 MB, all or nothing. Each item costs two underlying operations; a ClientRequestToken makes retries safe.

What do DynamoDB scenario questions look like?

Scenario rounds give a symptom or a requirement and watch how you get to the key design. Answer with the access patterns first, then the keys and indexes that serve them, then how it fails under load.

Orders by customer and by status

Base table keyed CUSTOMER#id and ORDER#date#id serves a customer's orders by date. A status GSI keyed on status alone would be a hot partition, so key it STATUS#status#shard and query the shards in parallel.

Writes throttle every morning at 9:00

Check whether the table is short of capacity or one key is hot (Contributor Insights shows the most accessed and throttled items). A batch writing under one date key hits the 1,000 write units a partition allows; shard the key and retry with backoff.

Get the table into the data lake

Stream the changes to S3 near real time (the consumer must keep up with 24-hour retention), or export the table to S3. Analytics read the S3 copy and never Scan the production table.

Question bank

22 interview questions with answers

Real questions from beginner to advanced, each with a concise model answer — practice them, then rehearse live in a mock interview. Every answer is open; collapse any you have already covered.

EasyWhat is DynamoDB, and when would a data engineer choose it?

DynamoDB is AWS's serverless NoSQL database for key-value and document data. You choose it when an application reads and writes items by a known key at high volume: session state, user profiles, event status, idempotency keys, feature lookups. You do not choose it for ad hoc analytics, joins or reporting; that data is copied out (through Streams or an export to S3) into a warehouse or lake such as Redshift or Athena on S3. Interviewers want to hear that you design a DynamoDB table around its read patterns first, the opposite of a relational schema.

EasyWhat are the partition key and the sort key in DynamoDB?

The primary key is either a partition key alone (a simple key) or a partition key plus a sort key (a composite key). DynamoDB hashes the partition key to decide which physical partition stores the item, and all items with the same partition key value are stored together, ordered by the sort key. A Query must give one exact partition key value and can narrow the sort key with conditions such as begins_with, between, greater than or less than. A partition key value can be up to 2048 bytes and a sort key value up to 1024 bytes.

EasyWhat is the maximum size of a DynamoDB item, and what do you do with bigger payloads?

An item can be at most 400 KB. Large payloads such as documents, images or raw event batches belong in S3, with the item holding the S3 key and a few attributes you query on. Designing items that grow without limit (for example appending every event to a list attribute) runs into the 400 KB ceiling, which is why time-ordered data is usually stored as many small items under one partition key instead.

EasyWhat is the difference between Query and Scan?

Query reads the items that share one partition key value, optionally narrowed by a sort key condition, so it touches only the data you asked for. Scan reads every item in the table or index. A filter expression on a Scan is applied after the items are read, so a Scan consumes the same read capacity with or without a filter. Both return at most 1 MB per call and hand back a LastEvaluatedKey when there is more. In an interview, needing a Scan for a regular access pattern is a sign the key or index design is wrong.

EasyWhat is the difference between strongly consistent and eventually consistent reads?

An eventually consistent read may not reflect a write that just completed; a strongly consistent read returns the latest committed value. Eventually consistent is the default and costs half as much: a global secondary index read consumes half a read capacity unit, so one unit covers 8 KB of eventually consistent reads against 4 KB strongly consistent. Global secondary indexes support only eventually consistent reads, because they are updated asynchronously. The base table and local secondary indexes support both.

EasyWhat are on-demand and provisioned capacity modes?

On-demand mode is pay-per-request: you do not specify read or write throughput and DynamoDB scales with the traffic. Provisioned mode means you set read capacity units (RCUs) and write capacity units (WCUs), optionally with auto scaling, and requests beyond the capacity are throttled. On-demand suits new, spiky or unpredictable workloads; provisioned suits steady traffic you can forecast. A table can be switched between the two modes.

EasyWhat is a global secondary index (GSI)?

A GSI is an index with a different partition key, and optionally a different sort key, from the base table, so you can query the same data by another attribute. DynamoDB keeps it up to date asynchronously, so reads from it are eventually consistent. You can add a GSI to an existing table (one per UpdateTable call), a table can have up to 20 by default (AWS can raise this), and on a provisioned table the index has its own read and write capacity, separate from the base table's.

EasyWhat is a local secondary index (LSI)?

An LSI keeps the base table's partition key but uses a different sort key, so you can sort and filter the items of one partition another way. LSIs can only be created with the table, through the CreateTable operation; you cannot add one later. A table can have up to five. LSIs support strongly consistent reads. The catch: on a table with LSIs, all items with one partition key value, across the table and its indexes, can total at most 10 GB.

MediumGSI or LSI: how do you choose?

Use a GSI when you need a different partition key, when you need the index on an existing table, or when the data per partition key can grow past 10 GB. Use an LSI only when you need another sort order inside the same partition and need strongly consistent reads from the index, and you know that at table creation. Most designs use GSIs; an LSI is a deliberate choice that you have to make up front and that caps each item collection at 10 GB.

MediumWhat is a hot partition, and how do you avoid one?

A hot partition is one partition taking far more traffic than the rest, usually because many requests share one partition key value, such as today's date or one big customer. A single partition serves at most 3,000 RCUs and 1,000 WCUs, so a hot key throttles even when the table has capacity to spare. Design keys so activity is spread evenly, use high-cardinality partition keys, and for heavy write keys use write sharding: add a suffix such as a random or calculated number from 0 to N to the key and read the shards back in parallel.

MediumWhat are burst capacity and adaptive capacity?

Burst capacity: DynamoDB keeps up to five minutes (300 seconds) of unused read and write capacity and can spend it during a short spike. Adaptive capacity: when traffic to some items is disproportionately high, DynamoDB rebalances partitions so frequently accessed items do not sit on the same partition. Neither removes the per-partition ceiling: even an isolated single item gets at most 3,000 RCUs and 1,000 WCUs, and adaptive capacity will not split item collections across partitions on a table with a local secondary index.

MediumHow do DynamoDB Streams work, and what do data engineers use them for?

A stream is a time-ordered log of item-level changes (inserts, updates, deletes) kept for up to 24 hours, and it can include the item as it looked before and after the change. Each stream record appears exactly once, and for any one item the records come in the order the changes happened. Data engineers use Streams for change data capture: a consumer (often a Lambda function) reads the changes and lands them in S3, a warehouse or a search index. The 24-hour retention means the consumer must keep up, or changes are lost.

MediumHow does TTL (time to live) work in DynamoDB?

You enable TTL on the table and name an attribute that holds each item's expiry time as a Number in Unix epoch seconds; items where that attribute is not a Number are ignored. DynamoDB deletes expired items itself, typically within a few days of expiry, without consuming write throughput. Until then, expired items still come back in reads, so use a filter expression to drop them from Query and Scan results. TTL deletions also appear in the table's stream, which is how you archive expired data to S3.

MediumHow do DynamoDB transactions work?

TransactWriteItems groups up to 100 write actions on up to 100 distinct items, in one or more tables in the same account and Region, into one all-or-nothing operation; the items can total at most 4 MB. TransactGetItems reads up to 100 items atomically. A transaction does two underlying reads or writes per item, so plan capacity for double the work. Pass a ClientRequestToken to make a TransactWriteItems call idempotent, so a retry after a timeout does not apply the writes twice.

MediumWhat is the difference between BatchWriteItem and TransactWriteItems?

BatchWriteItem sends up to 25 put or delete requests, up to 16 MB, in one call for efficiency, but the batch as a whole is not atomic: each put or delete succeeds or fails on its own, and failures come back in UnprocessedItems for you to retry, usually in a loop with backoff. TransactWriteItems is atomic: every action succeeds or none does, at a higher capacity cost. Use batches for bulk loads; use transactions when several writes must stay consistent, such as moving a balance between two items.

MediumHow do you paginate Query results?

DynamoDB returns Query results in pages of at most 1 MB. If the response contains a LastEvaluatedKey, there is more: send the same Query again with ExclusiveStartKey set to that value, and repeat until no LastEvaluatedKey comes back. A Limit parameter caps items per page, but a page can still stop at 1 MB. For APIs, return the LastEvaluatedKey to the client as an opaque cursor instead of using page numbers, because DynamoDB has no offset.

MediumWhat is single-table design?

Single-table design stores several entity types in one table, using generic key attributes (often PK and SK) with prefixed values such as CUSTOMER#123 and ORDER#2026-11-01#9001. A customer and their orders then share one partition key, so a single Query returns the customer with all their orders in sort-key order, with no join. You design it from the list of access patterns, adding GSIs for the patterns the base key cannot serve. The cost is that ad hoc questions are hard, so analytics run on a copy of the data in S3 or a warehouse.

HardModel orders so you can fetch a customer's orders by date and all orders in a given status.

Base table: PK = CUSTOMER#<id>, SK = ORDER#<order date>#<order id>, so a Query on one customer returns their orders sorted by date, and begins_with or between on SK gives a date range. For status, a GSI keyed on the status alone would be a hot partition (a few statuses, millions of orders), so make the GSI partition key STATUS#<status>#<shard>, with the shard a number from 0 to N computed from the order id, and the GSI sort key the order date. Reading one status means querying the N shards in parallel and merging by date.

HardWrites start throttling every morning at 9:00 when a batch job runs. How do you debug it?

First check whether the table is short of capacity overall or one key is hot: compare consumed against provisioned capacity in CloudWatch, and use CloudWatch Contributor Insights to see the most-accessed keys. A batch that writes everything under one key, such as today's date, hits the 1,000 WCU per-partition limit no matter what the table allows. Fix the key (write sharding or a higher-cardinality key), have the job retry UnprocessedItems and throttled requests with exponential backoff, and either raise provisioned capacity for the window or move the table to on-demand.

HardHow would you get DynamoDB data into a data lake for analytics?

Two common routes. Near real time: a consumer reads the table's stream and writes changes to S3 (partitioned by date) for Athena, Glue or Spark, keeping in mind that stream records are kept for only 24 hours, so the consumer must keep up. Bulk: export the table to Amazon S3 and process the export. Either way, analytics read the S3 copy and never Scan the production table, which would compete with the application's traffic for read capacity.

HardA payment service retries on timeouts and sometimes records a payment twice. How do you make the write idempotent?

Give each payment a client-generated id and write it with a condition expression such as attribute_not_exists on the key, so a second write of the same payment fails instead of creating a duplicate; treat that failure as success when the stored item matches. When the payment touches several items (a ledger row and a balance), use TransactWriteItems with a ClientRequestToken, which makes the transaction idempotent, so a retry after a connection timeout does not apply it twice.

HardWhy does a query on a GSI sometimes miss an item that was just written?

Because global secondary indexes are updated asynchronously and support only eventually consistent reads. AWS says changes normally reach the index within a fraction of a second, but a read right after the write can still miss it. If the caller must see its own write, read from the base table (or an LSI) with a strongly consistent read, or return the written item from the write call itself instead of re-reading it from the index.

By company

Data Engineer interviews that ask these questions

See how this topic shows up in real Data Engineer loops — rounds, difficulty and company-specific questions:

All company interview guides →

FAQ

Common Questions

Is DynamoDB asked in data engineer interviews in India?

Mostly in AWS-heavy roles, alongside S3, Glue and Redshift. The questions are about design rather than syntax: keys, indexes, throughput and getting the data out for analytics.

Do I need to know single-table design?

For senior roles, usually yes: be ready to put two related entities (a customer and their orders) in one table with prefixed keys so one Query returns both, and to explain what that design makes hard.

What is the item size limit in DynamoDB?

400 KB per item. Larger payloads go to S3, with the item holding the S3 key.

How can PrepNPlaced help?

Use AI Mock Interview to practise explaining a key design out loud, and the AWS and system design pages for the services around DynamoDB.

Next Step

Turn The Guide Into Practice

Use PrepNPlaced tools to turn this learning path into resume proof, targeted practice, and interview-ready explanations.

Practice AI Mock Interview