Skip to main content
devops

Google Spanner Removes Cumulative DML Mutation Limits, Enabling Larger Transactions

Google Cloud has changed how Spanner handles DML mutation limits. The 80,000-mod cap now applies separately to each DML statement, allowing transactions to contain multiple larger operations without a cumulative DML mutation limit.

Xcademia Team

Xcademia Research Team

Sep 11, 20266 min read5 views
Share:
Google Spanner Removes Cumulative DML Mutation Limits, Enabling Larger Transactions

Google Spanner Removes Cumulative DML Mutation Limits, Enabling Larger Transactions

Google Cloud has announced a change to Spanner that gives developers more flexibility when handling larger and more complex transactions.

The database service has moved its 80,000 mutation modification limit from the transaction level to the individual DML statement level. This means applications can now execute multiple DML statements inside the same transaction without those statements contributing to a shared 80,000-mod DML limit.

The change is designed for operational workloads where several related database updates need to succeed or fail together while maintaining transactional consistency.


What Changed in Spanner?

Previously, Spanner applied an 80,000 mutation-mod limit to changes performed through DML within a transaction.

The approximate mutation count could depend on the number of rows and columns affected, as well as updates involving dependent indexes. As applications grew more complex, transactions that were once comfortably below the limit could eventually reach it.

With the new approach, the limit is evaluated separately for each DML statement.

A transaction can now contain multiple INSERT, UPDATE, or DELETE statements, provided that each individual DML statement generates fewer than 80,000 mutation mods.

Previous model

Transaction

→ DML statement 1
→ DML statement 2
→ DML statement 3
→ DML statement 4

Combined DML mutation limit: 80,000 mods

New model

Transaction

→ DML statement 1 → evaluated separately
→ DML statement 2 → evaluated separately
→ DML statement 3 → evaluated separately
→ DML statement 4 → evaluated separately

Each individual DML statement must remain below 80,000 mods.

This allows developers to organize related operations around business requirements instead of splitting transactions simply to avoid a cumulative DML mutation limit.


Why This Matters for Operational Applications

Operational databases often need to perform several related changes as part of one business operation.

For example, an ecommerce transaction could involve updating product availability, inserting order-item information and updating an order record. If these changes need to remain transactionally consistent, putting them into one transaction can simplify application logic.

Google describes this type of workload as one where real-time decisions and granular database updates need to happen together. If the transaction succeeds, the related changes are committed. If it fails, the changes do not partially apply.

The new Spanner behavior provides more room for these multi-step transactions when individual DML statements remain below the mutation threshold.


dml-mutation


Larger Transactions Without Application Code Changes

One notable part of the announcement is that existing Spanner client libraries remain compatible with the change.

Google says applications do not need code updates to take advantage of the new DML limit behavior.

That makes the change relatively straightforward for existing applications that already use DML transactions.

However, the change does not mean every transaction should automatically become larger.

There are still practical considerations around transaction duration, locking and resource contention.


Larger Transactions Can Still Increase Locking

Removing the cumulative DML mutation limit does not remove the other characteristics of database transactions.

Larger and longer-running transactions can hold locks for longer periods. According to Google, this can increase the likelihood of lock contention and transaction aborts. Keeping transactions concise can therefore still be important for maintaining performance and reducing resource contention.

This creates an important distinction:

The limit has become more flexible, but transaction design still matters.

Developers should therefore use the additional capacity when it makes sense for the application's business logic rather than treating the change as a reason to combine unrelated operations into very large transactions.


careful-design


DML and the Mutation API Are Different

The new limit behavior applies specifically to DML statements.

Google distinguishes this from the Spanner Mutation API.

With DML, each statement is evaluated independently against the 80,000 mutation-mod limit. For example, a call such as executeUpdate is evaluated on its own.

The Mutation API works differently. When client-library methods such as insert() or update() are used, mutations are supplied during the Commit call. The 80,000 limit continues to apply to the entire set of mutations included in that single call.

This distinction is important when deciding how an application should perform large database operations.

Approach

How the 80,000-mod limit is applied

DML statements

Each individual DML statement is evaluated separately

Mutation API

The limit applies to the complete set of mutations in one commit call


What Exactly Is a Mutation Mod?

A mutation mod represents the amount of database change generated by an operation.

Spanner's calculation considers the complexity of the changes, including modified cells, primary keys and secondary-index updates. This means the number of application-level records being changed does not necessarily equal the number of mutation mods.

Developers can monitor the total number of mods associated with a committed transaction using mutation_count in CommitStats.

Google also notes that this statistic includes mutations from the transaction across DML statements and commit calls.


spanner-mutation-mod


Java Example Shows the New Transaction Model

Google's announcement includes a Java example demonstrating multiple DML operations inside a single read-write transaction.

The example performs separate UPDATE statements against products, inserts related order-item information and updates the order record.

Under the new model, each DML statement is evaluated independently against the 80,000-mod limit rather than contributing to a cumulative DML limit across the transaction.

The important concept is not the specific Java syntax. It is the transaction structure:

One business operation

→ Update product
→ Update another product
→ Insert order item
→ Update order timestamp
→ Commit transaction

This approach can make it easier to group logically related operations while preserving transactional behavior.


What Has Not Changed?

The announcement does not remove all Spanner transaction constraints.

Most importantly, a single DML statement that generates more than 80,000 mutation mods will still exceed the individual statement limit and return the same type of error as before.

Other transaction constraints also remain in place, including the maximum transaction size measured in bytes.

Therefore, the update should be viewed as a change to how the DML mutation limit is applied, rather than a removal of all transaction limits.


What Should Developers Do?

Google recommends monitoring transaction activity and optimizing operations that approach the limit.

The mutation_count value available through CommitStats can help developers understand how much mutation activity their operations generate.

If one individual DML statement is too large, developers still have alternatives.

Google specifically points to:

  • Partitioned DML for suitable large-scale operations

  • Pagination through keys when processing data in smaller groups

  • Monitoring mutation counts through CommitStats

  • Keeping transactions concise when possible

These practices remain relevant because the new model changes the cumulative DML limit, not the individual statement limit or other transaction constraints.


What the Change Means for Spanner Applications

The announcement highlights a broader industry shift toward database platforms that can handle increasingly complex operational workloads without forcing developers to redesign application transactions around artificial limits.

For applications using Spanner, the change provides greater flexibility when several DML operations need to remain part of one transaction.

It also reduces one potential source of application complexity because developers no longer need to split DML operations solely because their combined mutation count would exceed the previous transaction-level threshold.

At the same time, database architecture still requires careful transaction design. Larger transactions can have consequences for locking and contention, so the additional flexibility should be used selectively.


The Bottom Line

Google Cloud's Spanner update changes the 80,000 mutation-mod limit from a cumulative transaction-level restriction for DML to an individual-statement restriction.

That means a single transaction can contain multiple DML statements, including INSERT, UPDATE and DELETE, as long as each statement remains below the 80,000-mod threshold.

Existing Spanner client libraries remain compatible, and Google says applications do not require code changes to benefit from the change. However, individual DML statements and other transaction limits still apply.

For developers building operational applications on Spanner, the update provides more freedom to structure multi-step transactions around business requirements while retaining Spanner's transactional consistency model.

#GoogleCloud#CloudSpanner#Spanner#Databases#DML#CloudDatabase#DistributedDatabases#DatabaseTransactions

About the Author

X
Xcademia Team
Xcademia Research Team
Share:
Master the platforms behind this storyCloud Engineer Bootcamp: live cohorts enrolling now, with optional Career+ support.