Canonical: https://weaveos.com/reference/bigquery/estimate-query-bytes-before-running

1. [Software capabilities](https://weaveos.com/reference)
2. /[BigQuery](https://weaveos.com/reference/bigquery)
3. /Estimate query bytes before running

[![](https://weaveos.com/reference/logos/bigquery.svg)BigQuery](https://weaveos.com/reference/bigquery)

# Estimate query bytes before running

BigQuery can validate a query and estimate its processed bytes with a dry run. Use the REST query job for automation or the bq command when you are working in a terminal.

Documentation reviewed November 27, 2026 · 2 methods with sources

## Ways to do it

1. [1API: POST /bigquery/v2/projects/{projectId}/queries](https://weaveos.com/reference/bigquery/estimate-query-bytes-before-running#method-1)
2. [2CLI: bq query --dry\_run](https://weaveos.com/reference/bigquery/estimate-query-bytes-before-running#method-2)

API

### POST /bigquery/v2/projects/{projectId}/queries

Submit a jobs.query request with dryRun enabled. The response validates the SQL and reports estimated bytes processed without running the query.

[Read source: BigQuery jobs.query API](https://docs.cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query)

- Requirements

  A Google Cloud project, Application Default Credentials or an OAuth access token, BigQuery Job User permission on the project, and access to the referenced datasets and tables.

- Limitations

  Dry runs of federated queries can report a lower bound of zero bytes, and tables protected by row-level security return zero bytes, so those estimates are not a reliable cost ceiling.

Example json

Copy

```
{
  "query": "SELECT COUNT(*) FROM `PROJECT.DATASET.TABLE`",
  "dryRun": true,
  "useLegacySql": false,
  "useQueryCache": false
}
```

CLI

### bq query --dry\_run

Validate a GoogleSQL statement and print the estimated bytes from the bq command-line tool.

[Read source: BigQuery cost controls and bq dry run](https://docs.cloud.google.com/bigquery/docs/best-practices-costs)

- Requirements

  The Google Cloud CLI with bq installed, an authenticated account, a default project or --project\_id, and permission to create query jobs and read referenced tables.

- Limitations

  The command only validates and estimates the statement. It does not return query rows or account for bytes from an external source that BigQuery cannot determine until execution.

Example shell

Copy

```
bq query --use_legacy_sql=false --dry_run 'SELECT COUNT(*) FROM `PROJECT.DATASET.TABLE`'
```

## More from BigQuery

[View all 1 BigQuery tasks](https://weaveos.com/reference/bigquery)
