0
0
DynamoDBquery~10 mins

Transaction limits in DynamoDB - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Transaction limits
Start Transaction
Check Item Count <= 100?
NoReject Transaction
Yes
Check Total Size <= 4 MB?
NoReject Transaction
Yes
Execute All Operations
Commit Transaction
End
A DynamoDB transaction must have 100 or fewer items and total size under 4 MB to proceed; otherwise, it is rejected.
Execution Sample
DynamoDB
TransactWriteItems(
  Items: 3,
  TotalSize: 1.2MB
)
This transaction tries to write 3 items with total size 1.2 MB, which is within limits.
Execution Table
StepCheckValueResultAction
1Number of items <= 100?3 <= 100TrueProceed
2Total size <= 4 MB?1.2 MB <= 4 MBTrueProceed
3Execute all operations3 itemsSuccessCommit transaction
4Transaction ends--Transaction committed successfully
💡 Transaction ends after successful commit because all limits are met.
Variable Tracker
VariableStartAfter Step 1After Step 2Final
ItemCount0333
TotalSizeMB01.21.21.2
TransactionStatusNot startedChecking limitsLimits OKCommitted
Key Moments - 2 Insights
Why can't a transaction have more than 100 items?
Because DynamoDB enforces a hard limit of 100 items per transaction to ensure performance and atomicity, as shown in execution_table step 1 where exceeding 100 would reject the transaction.
What happens if the total size exceeds 4 MB?
The transaction is rejected immediately, as shown in execution_table step 2 where the size check fails if over 4 MB.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the result of the item count check at step 1?
AFalse
BTrue
CError
DSkipped
💡 Hint
Refer to execution_table row 1 under 'Result' column.
At which step does the transaction commit happen?
AStep 3
BStep 2
CStep 1
DStep 4
💡 Hint
Check execution_table row 3 under 'Action' column.
If the transaction had 105 items, what would happen at step 1?
AProceed to size check
BCommit transaction
CReject transaction
DIgnore item count
💡 Hint
Refer to concept_flow where item count > 100 leads to rejection.
Concept Snapshot
DynamoDB transactions have two main limits:
- Max 100 items per transaction
- Max total size 4 MB
If either limit is exceeded, the transaction is rejected.
All operations must succeed or none are applied.
Check limits before commit to ensure success.
Full Transcript
In DynamoDB, transactions have limits to keep them efficient and reliable. You can include up to 100 items in a transaction. Also, the total size of all items combined must be 4 megabytes or less. When you start a transaction, DynamoDB first checks if the number of items is 100 or fewer. If not, it rejects the transaction immediately. If the item count is okay, it then checks if the total size is within 4 MB. If the size is too big, it rejects the transaction. If both checks pass, DynamoDB executes all operations together and commits the transaction. This means either all changes happen or none do, keeping your data consistent. This step-by-step process helps ensure your transaction meets DynamoDB's rules before it runs.