Skip to content

TransactWriteItems leaves index write units out of ConsumedCapacity #866

Open

Description

@LeeroyHannigan

What is wrong

With ReturnConsumedCapacity set to INDEXES, Amazon DynamoDB reports the units a transaction writes to each global secondary index, and counts them in the total. ExtendDB reports the table alone.

Measured in us-east-1 on 2026-11-05, on a table with one global secondary index, gsi:

Request DynamoDB ExtendDB
TransactWriteItems, one Update that changes the gsi key of an item CapacityUnits 4, Table 2, GlobalSecondaryIndexes.gsi 2 CapacityUnits 2, Table 2, no index entry
TransactWriteItems, two Updates, TOTAL CapacityUnits 6 CapacityUnits 4

ExecuteTransaction on #411 gives the same numbers as TransactWriteItems on both sides, because it runs through the same code.

Where

crates/engine/src/transact_write_items.rs, at the note that the per-index breakdown for transactions is deferred: the engine has no old or new item for an Update or Delete member, so it cannot tell which index entries a write changes. The storage layer's transact_write_items returns neither on any of the four backends.

What to change

  1. Have transact_write_items on SQLite, PostgreSQL, MongoDB and Cassandra return the old and the new item of each member, or the index entries each member wrote.
  2. Rate each member's index writes as the single-item writes do, and add them to the index entries and to the total.
  3. Remove the expected-failure marks on test_a_transaction_reports_its_index_units and test_a_transaction_total_counts_its_index_units in tests/test_partiql_transaction.py (from feat(partiql): implement ExecuteStatement, BatchExecuteStatement, ExecuteTransaction #411), and add the same cases for TransactWriteItems.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions