ASSOCIATE-CLOUD-ENGINEER practice question 31 of 35

You need to run an important query in BigQuery but expect it to return a lot of records. You want to find out how much it will cost to run the query. You are using on-demand pricing. What should you do?

Full set: 332 questions
Answer options
A: Arrange to switch to Flat-Rate pricing for this query, then move back to on-demand.
B: Use the command line to run a dry run query to estimate the number of bytes read. Then convert that bytes estimate to dollars using the Pricing Calculator. Correct answer
C: Use the command line to run a dry run query to estimate the number of bytes returned. Then convert that bytes estimate to dollars using the Pricing Calculator.
D: Run a select count (*) to get an idea of how many records your query will look through. Then convert that number of rows to dollars using the Pricing Calculator.
Correct Answer:
B. Use the command line to run a dry run query to estimate the number of bytes read. Then convert that bytes estimate to dollars using the Pricing Calculator.
Explanation

BigQuery's on-demand pricing model charges for the number of bytes read (processed) by a query, not the amount of data returned. The most effective way to estimate this cost without incurring any charges is to perform a dry run. The bq query --dryrun command-line flag or the query validator in the Google Cloud Console simulates the query execution. It validates the query and returns an estimate of the total bytes that will be processed. This byte estimate can then be entered into the Google Cloud Pricing Calculator to determine the monetary cost before you execute the actual query.

Why Incorrect

A. Switching pricing models is a commitment for managing overall costs, not a method for estimating the cost of a single on-demand query.
C. On-demand pricing is based on the volume of data read from the tables, not the volume of data returned to the user.
D. Running SELECT COUNT() is a billable query that processes data and provides a row count, not the byte-based estimate needed for cost calculation.

References

1. Google Cloud Documentation - BigQuery pricing, "Query pricing models": "On-demand pricing is based on the amount of data processed by your queries... You are charged for the number of bytes processed (also referred to as bytes read)." This confirms the pricing metric is bytes read.

2. Google Cloud Documentation - "Estimate query costs": "You can estimate the cost of a query before you run it. To estimate query costs, you can use: The query validator in the Google Cloud console... The --dryrun flag in the bq command-line tool... When you use one of these options, BigQuery returns an estimate of the number of bytes that the query will read." This directly supports using a dry run to estimate bytes read.

3. Google Cloud Documentation - bq command-line tool reference, "bq query": Describes the --dryrun flag: "If set, the query is not executed. Instead, a server-side analysis is performed to determine query statistics, such as the total bytes that are processed." This confirms the function of the command-line tool option.

Scroll to Top