adrpino
adrpino

Reputation: 1060

Are LIMIT 0 queries billed in BigQuery?

I was thinking to use this together with DBT to check that all the DAG, dependencies and such is correct without incurring in costs.

I was thinking of adding a LIMIT 0 in BigQuery queries. I'm not finding any official doc stating whether this is the case.

Are those queries not billed?

Upvotes: 0

Views: 527

Answers (1)

Daniel Zagales
Daniel Zagales

Reputation: 3034

Correct, this will not bill any data. You can run a dry run to verify:

dzagales@cloudshell:~ (elzagales)$ bq query --use_legacy_sql=false --dry_run 'SELECT * FROM `bigquery-public-data.austin_311.311_service_requests` LIMIT 0'
Query successfully validated. Assuming the tables are not modified, running this query will process 0 bytes of data.
dzagales@cloudshell:~ (elzagales)$ bq query --use_legacy_sql=false --dry_run 'SELECT * FROM `bigquery-public-data.austin_311.311_service_requests` LIMIT 1'
Query successfully validated. Assuming the tables are not modified, running this query will process 254787 bytes of data.

Above you can see a LIMIT 0 bills 0 bytes, while a LIMIT 1 will scan the whole table.

Upvotes: 2

Related Questions