BigQuery error · Resources and limits
Operation timed out after 6.0 hours
A BigQuery query or statement can run for at most 6 hours. The job hit that limit and failed. Make it do less work (partition filters, fewer columns, incremental processing) or split it into smaller jobs. A job that hits your own jobTimeoutMs fails with reason stopped instead.
The error message
Operation timed out after 6.0 hours. Consider reducing the amount of work performed by your operation so that it can complete within this limit.
Causes
The query does too much work for one job
Full-table rebuilds, backfills over years of partitions, or joins that multiply rows can run for hours. Each statement in a multi-statement query has the same 6-hour limit; a child statement that times out reports Request timed out. Please try again. at [<line>:<column>].
Too few slots for the work
A query that finishes in minutes with enough slots can take hours in a small reservation that is shared with other workloads, or while it waits behind other jobs. The limit counts wall time, not slot time.
Your own timeout was shorter
If the job sets jobTimeoutMs, or the project has default_query_job_timeout_ms, BigQuery cancels it at that point. That error is Job execution was cancelled: Job timed out after <duration> with reason stopped, not timeout. A dry run that takes too long fails with Dry run query timed out.
How to fix it
1. Read fewer partitions and columns
Less data per job is less time. Filter on the partitioning column and select only the columns you need.
SELECT customer_id, SUM(amount) AS revenue
FROM `project.dataset.orders`
WHERE order_date BETWEEN '2026-11-01' AND '2026-11-22'
GROUP BY customer_id;2. Process incrementally instead of rebuilding
Process only new partitions and merge them into the target, so each run handles a day instead of the whole history.
MERGE `project.analytics.daily_revenue` AS t
USING (
SELECT order_date, customer_id, SUM(amount) AS revenue
FROM `project.dataset.orders`
WHERE order_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
GROUP BY order_date, customer_id
) AS s
ON t.order_date = s.order_date AND t.customer_id = s.customer_id
WHEN MATCHED THEN UPDATE SET revenue = s.revenue
WHEN NOT MATCHED THEN INSERT (order_date, customer_id, revenue)
VALUES (s.order_date, s.customer_id, s.revenue);3. Split a backfill into batches
Loop over months or weeks in a script, or run one job per partition range from your orchestrator, so every job finishes well inside the limit and a failure only reruns one batch.
4. Find the slow stage
Open the job's Execution details or query performance insights: a stage with a huge row count or one worker far slower than the rest (skew) usually points at the join or aggregation to fix.
How to prevent it
- Set a project default timeout far below 6 hours so runaway queries stop early: set the
region-us.default_query_job_timeout_msoption withALTER PROJECT ... SET OPTIONS, for example to1800000(30 minutes). The value must be between 5 minutes and 48 hours. - Alert on queries whose runtime grows run over run: compare
TIMESTAMP_DIFF(end_time, start_time, MINUTE)for the same scheduled query in INFORMATION_SCHEMA.JOBS. - Rank long and expensive jobs with the most expensive queries query; jobs close to the limit are usually also the costliest under editions.
FAQ
Am I charged for a query that timed out after 6 hours?
On-demand, queries that return an error aren't charged. Under editions, up to 6 hours of slot time were spent and are lost, which is why a timed-out pipeline is one of the most expensive failures. Google notes that a canceled job can still incur costs depending on the stage at which it was canceled.
Can a BigQuery query run longer than 6 hours?
Not a single attempt. BigQuery may internally retry a query after transient issues, up to three attempts of 6 hours each, so a job's total runtime can exceed 6 hours, but you can't raise the per-attempt limit.
What's the difference between reason timeout and reason stopped?
timeout means BigQuery's own 6-hour limit was reached. stopped means the job was canceled, either by a user or tool or by a timeout you configured (jobTimeoutMs or default_query_job_timeout_ms).
Related
SQL reference
More resources and limits
All BigQuery error messages · What 50M daily events say about BigQuery failures
