Estimating Storage and Query Costs

On-demand queries are charged based on the number of bytes read. For current on-demand query pricing, see the pricing page.

To estimate costs before running a query use the:

Estimating query costs

To estimate query costs:

Web UI

When you enter a query in the web UI, the query validator verifies the query syntax and provides an estimate of the number of bytes read. You can use this estimate to calculate query cost in the pricing calculator.

Query validator

If your query processes a small amount of data, you might need to convert the bytes that are processed from KB to MB. MB is the smallest measure that is used by the pricing calculator.

Command-line

When you run a query in the CLI, you can use the --dry_run flag to estimate the number of bytes read. You can use this estimate to calculate query cost in the pricing calculator.

A CLI query that uses the --dry_run flag looks like the following:

    bq query --use_legacy_sql=false --dry_run 'SELECT [FIELD1], [FIELD2], [FIELD3] FROM `[PROJECT].[DATASET].[TABLE]` LIMIT 1000'

When you run the command, the response contains the estimated bytes read: Query successfully validated. Assuming the tables are not modified, running this query will process 10918 bytes of data.

If your query processes a small amount of data, you might need to convert the bytes that are processed from KB to MB. MB is the smallest measure used by the pricing calculator.

API

To perform a dry run by using the API, submit a query job with jobs.configuration.dryRun set to true.

Estimating query costs using the Google Cloud Platform Pricing Calculator

To estimate on-demand query costs in the Google Cloud Platform Pricing Calculator, enter the number of bytes that are processed by the query as MB, GB, TB, or PB. If your query processes less than 1 TB, the estimate is $0 because BigQuery provides 1 TB of on-demand query processing free per month.

Pricing calculator

To estimate the cost of a query using the pricing calculator:

  1. Open the Google Cloud Platform Pricing Calculator,
  2. Click BigQuery.
  3. Click the On-Demand tab.
  4. For Table Name, type the name of the table. For example, airports.
  5. For Storage Pricing, enter 0 in the Storage field.
  6. For Query Pricing, enter the estimated bytes read from your dry run or the query validator. If the value is less than 1 MB, you must convert it to MB for the pricing calculator. Using 10918 bytes as an example, the value is approximately 0.01091 MB. Calculator
  7. Click Add To Estimate.
  8. The estimate appears to the right. Notice that you can save or email the estimate. On-demand calculator

In this case, the number of bytes read by the query is below the 1 TB of on-demand processing provided via the free tier. As a result, the estimated cost is $0.

Including flat-rate pricing in the pricing calculator

If you have flat-rate pricing applied to your billing account, you can click the Flat-Rate tab, choose your flat-rate plan, and add your storage costs to the estimate.

Flat-rate calculator

For more information, see Flat-rate pricing.

Estimating storage costs using the Google Cloud Platform Pricing Calculator

To estimate storage costs in the Google Cloud Platform Pricing Calculator, enter the number of bytes that are stored as MB, GB, TB, or PB. BigQuery provides 10 GB of storage free per month.

To estimate storage costs using the pricing calculator:

  1. Open the Google Cloud Platform Pricing Calculator,
  2. Click BigQuery.
  3. Click the On-Demand tab.
  4. For Table Name, type the name of the table. For example, airports.
  5. For Storage Pricing, enter 100 in the Storage field. Leave the measure set to GB.
  6. Click Add To Estimate.
  7. The estimate appears to the right. Notice that you can save or email the estimate. Pricing calculator

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...