# Transactions

* Coordinated all or nothing operations _(update/delete/add)_ to multiple items across one or more tables.
* This provides ACID guarantees.
* There are 3 read modes
  * Eventual Consistency
  * Strong Consistency
  * Transactional
* There are 2 write modes
  * Standard
  * Transactional
* It consumes twice the WCU and RCU. This is because DynamoDB performs 2 operations for every item _(prepare and commit)_.
* The two operations are
  * `TransactGetItems` → To do one or more `GetItem` operations.
  * `TransactWriteItems` → To do one or more `PutItem`, `UpdateItem` and `DeleteItem` operations.
* Use cases includes financial transactions, managing orders, multiplayer games etc.

## Transacional Capacity Computation

*   To calculate transaction write capacity `WCU` the formula is,

    ```
        (Number of transactions) * (Item-size/1 KB) * 2 * (transactional cost)
    ```
*   To calculate transaction read capacity `RCU` the formula is,

    ```
        (Number of transactions) * (Item-size rounded to upper factor of 4/4 KB) * 2 * (transactional cost)
    ```
