How would you put guardrails on a runaway BigQuery bill using maximum_bytes_billed and custom quotas?

Quick Overview

Describe how to keep BigQuery query costs under control with a per-query bytes billed limit and project or per-user daily quotas. Tests practical knowledge of cloud data warehouse cost controls, which ones stop spend versus only alert, and how to set limits without blocking real work.

How would you put guardrails on a runaway BigQuery bill using maximum_bytes_billed and custom quotas?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Other

How would you put guardrails on a runaway BigQuery bill using `maximum_bytes_billed` and custom quotas? Assume an analytics team runs ad hoc and scheduled queries on on-demand (per-byte) pricing, and the bill has spiked after a few large scans. ```hint Two failure modes Separate one query that scans far too much from many reasonable queries that add up over a day. Each needs a different control. ``` ```hint What happens at the limit For each control you name, ask what happens at the moment the limit is hit: does the query fail, get billed anyway, or only trigger a notification? ``` ### Clarifying Questions to Ask - Is the project on on-demand pricing, capacity (slot reservation) pricing, or a mix? - Who runs the expensive queries: analysts in the console, BI tools, or scheduled service accounts? - Is it acceptable for a legitimate job to fail when it hits a cap, or do some pipelines need a separate budget? - Are the large tables partitioned and clustered, and do queries filter on the partition column? ### What a Strong Answer Covers - How `maximum_bytes_billed` behaves when a query would exceed it, and where it is set. - What the project-level and per-user daily quotas limit, and how they differ from the per-query cap. - Which controls stop spend and which only estimate or alert. - Supporting measures such as dry runs, partition filters, usage monitoring and capacity pricing for heavy workloads. - The limits of each control and their effect on legitimate jobs. ### Follow-up Questions - How would you choose the per-query cap and the daily quotas without blocking legitimate scheduled jobs? - A query on a clustered table fails the `maximum_bytes_billed` check even though you expect it to scan much less. Why can that happen? - How do these controls change if the project moves to capacity pricing? - How would you find which users or jobs drove last week's spike?

Overview: Describe how to keep BigQuery query costs under control with a per-query bytes billed limit and project or per-user daily quotas. Tests practical knowledge of cloud data warehouse cost controls, which ones stop spend versus only alert, and how to set limits without blocking real work.

Nov 25, 2026
mediumData ScientistOtherData Manipulation (SQL/Python)
0
0

How would you put guardrails on a runaway BigQuery bill using maximum_bytes_billed and custom quotas?

Assume an analytics team runs ad hoc and scheduled queries on on-demand (per-byte) pricing, and the bill has spiked after a few large scans.

Clarifying Questions to Ask Guidance

  • Is the project on on-demand pricing, capacity (slot reservation) pricing, or a mix?
  • Who runs the expensive queries: analysts in the console, BI tools, or scheduled service accounts?
  • Is it acceptable for a legitimate job to fail when it hits a cap, or do some pipelines need a separate budget?
  • Are the large tables partitioned and clustered, and do queries filter on the partition column?

What a Strong Answer Covers Guidance

  • How maximum_bytes_billed behaves when a query would exceed it, and where it is set.
  • What the project-level and per-user daily quotas limit, and how they differ from the per-query cap.
  • Which controls stop spend and which only estimate or alert.
  • Supporting measures such as dry runs, partition filters, usage monitoring and capacity pricing for heavy workloads.
  • The limits of each control and their effect on legitimate jobs.

Follow-up Questions Guidance

  • How would you choose the per-query cap and the daily quotas without blocking legitimate scheduled jobs?
  • A query on a clustered table fails the maximum_bytes_billed check even though you expect it to scan much less. Why can that happen?
  • How do these controls change if the project moves to capacity pricing?
  • How would you find which users or jobs drove last week's spike?