A report statement computes the same expensive window-function subquery in three separate branches, and that work accounts for a large share of slot consumption. Which change reduces the total slot time?
Show answer and explanation
Answer: A
When the same costly subquery is repeated, BigQuery may compute it more than once within a statement. Writing it once to a temporary table and reading that table in each branch pays the compute cost a single time. Correlated subqueries usually execute per row and cost more than set-based window functions. Interactive priority changes scheduling rather than total work. A CROSS JOIN multiplies rows and increases the work instead of reducing it.
Why the other options are wrong
- B. Correlated subqueries usually execute per row and generally cost more than set-based window functions, so this change increases slot consumption.
- C. Interactive priority changes how the query is scheduled and may affect queueing, but it does not reduce the total work the statement requires.
- D. A CROSS JOIN produces every combination of rows from the branches, multiplying data volume and slot usage rather than reducing them.