Spanner: Removing cumulative m... Note

Spanner: Removing cumulative mutation limits for DML transactions

Google Cloud Spanner, a globally consistent relational database, has updated its transaction handling for larger, more complex operations. Previously, Spanner limited total transaction modifications to 80,000 "mutation mods." This limit, calculated as rows multiplied by columns plus indexes, could be reached by evolving applications. The new flexibility shifts this 80,000 mutation mod limit from the entire transaction to individual Data Manipulation Language (DML) statements. This means a single transaction can now contain multiple DML statements, provided each statement adheres to its own 80,000 mod limit. This allows developers to group DML statements logically by business requirements without artificial splitting. The change is backward compatible with existing Spanner client libraries, requiring no application code updates. However, developers should be mindful that larger transactions hold locks longer, potentially increasing aborts. The 80,000 mod limit applies individually to DML statements but still applies to the entire set of mutations in a single commit call using the Mutation API. Developers can monitor the total mods via mutation_count in CommitStats. Single DML statements exceeding 80,000 mods will still error, and other transaction limits like byte size remain active. Best practices include monitoring CommitStats and optimizing large operations. Spanner remains a reliable choice for scalable, always-on operational applications, now offering enhanced flexibility for developers.