简体   繁体   中英

What is the difference between BatchGetItem and TransactionGetItems in DynamoDB?

I have been searching SO for this but I didn't find an answer to this. (BatchGetItem vs Query i DID find but not what I'm looking for). I do know the basics:-

BatchGetItem you can request for items from ONE OR MORE TABLES and if the resultset exceeds 100 entities or 16MB -> It will return you an UnprocessedKeys using which you can query the next set of results

"TransactionGetItems" you can request for items from ONE OR MORE TABLES for upto 25 entities or 4MB -> Errors if size of aggregate response exceeds 4MB

What then is the use of TransactionGetItems over BatchGetItem ? From trawling the docs, I could make out that TransactionGetItems will fail if there are underlying writes happening that impact the same data. Is this the primary use of TransactionGetItems over BatchGetItem , which I assume WONT fail under the same conditions?

TransactGetItem allows you to have an all or nothing transaction. Either all GetItem operations in the transactions succeed or none of them do. If one fails, no data is returned. In addition TransactGetItem uses serializable isolation and a plain BatchGetItem does not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM