Database / Google Spanner Database Interview questions
What is the difference between batch DML and partitioned DML?
| Batch DML | Partitioned DML |
| Groups several DML statements into one transaction. | Splits one large DML statement across many transactions internally. |
| Fully atomic - all statements commit or none do. | Not atomic as a whole - executes as independent sub-ranges. |
| Bound by normal transaction size and lock limits. | Designed for bulk updates/deletes across millions of rows. |
Batch DML is the right tool when you have several related, moderate-size statements that must succeed or fail together, like updating a handful of related tables in one logical change. Partitioned DML is built for maintenance-style operations, such as deleting rows older than a retention window across an entire large table, where wrapping the whole thing in a single transaction would exceed transaction limits or hold locks far too long.
More Related questions...