Introduction to optimizing query performance

Overview

In general, queries that do less work perform better. Queries that perform better consume fewer resources which can result in lower costs and fewer failures. This page provides an overview of optimization techniques that can improve query performance in BigQuery with links to learn more.

Query performance

When evaluating query performance in BigQuery, the amount of work required depends on a number of factors:

Many of these factors can be observed through the query plan. A query plan is generated for each query submitted to BigQuery. You can see execution statistics such as bytes read and slot time consumed. The query plan also shows the different stages of execution which can help to identify ways to improve query performance. To learn more about query plans, see Query plan and timeline. To see a query plan for an example query, see an example query.

Even an optimized query may run slowly due to slot contention. For example, if there are 10,000 slots available among 6 projects, not all of them will be able to use 2,000 slots. This might cause the queries or jobs to slow down. If your queries cannot be optimized further, consider using reservations.

What's next