Professional Data Engineer free question 2 / 10 · Domain 1: Designing data processing systems
A BigQuery multi-statement transaction is updating rows in a table. Which statement about other operations on that same table during that time matches the "Multi-statement transactions" page?
- While the update is in progress, an INSERT that adds rows to the same table is queued until the transaction completes
- While a transaction modifies rows in a table, SELECT queries, streaming writes, and WRITE_APPEND load jobs can run at the same time
- Another transaction that modifies rows in the same table can also run at the same time, and the change that commits first is kept
- While the update is in progress, a DML statement outside the transaction that modifies rows in the same table runs right away without being queued
Show the answer and explanation
Answer: B
Why this is correct
The "Transaction concurrency" section says that while a transaction is mutating (updating or deleting) rows in a table, other transactions or DML statements that mutate rows in the same table cannot run concurrently. Read operations and operations that add new rows can run concurrently. It lists as examples SELECT statements, reads through the BigQuery Storage Read API, queries from BI Engine, INSERT statements, load jobs that add rows with WRITE_APPEND, and streaming writes.
Why the other options are wrong
"Another transaction that modifies rows in the same table can also run at the same time, and the change that commits first is kept" … The section says that while a transaction is mutating rows in a table, other transactions that mutate rows in the same table cannot run concurrently, and conflicting transactions are cancelled.
"While the update is in progress, a DML statement outside the transaction that modifies rows in the same table runs right away without being queued" … The section says that conflicting DML statements outside a transaction are queued to run later, up to a queue limit. They do not run right away.
"While the update is in progress, an INSERT that adds rows to the same table is queued until the transaction completes" … The section says that read operations and operations that add new rows can run concurrently with the transaction, and it lists INSERT statements as an example.
Key point
Transactions guarantee ACID properties and support snapshot isolation. A read inside a transaction returns a consistent snapshot of the tables it references, and changes made inside the transaction are visible to later statements in the same transaction. A single transaction can change at most 100 tables.