Nikhil Varma
Nikhil Varma

Reputation: 37

How exactly is query charged in google cloud bigquery

I would like to get a better insight and intuition on how Google Cloud BigQuery Charges us for a query ($5 for TB of query as seen on the website). The confusion is, does it charge us for the size of the table/s on which the query is applied or the amount/size of data returned by the query. Like for example, let's say I have a table of size 2 GB and I run a query on it and its returns a data of size 30 MB. So will I be charged for 2GB i.e the size of the table or for 30 MB i.e the data returned by the query.

Upvotes: 2

Views: 643

Answers (2)

Hemanth Kondapalli
Hemanth Kondapalli

Reputation: 1302

You are charged for the number of bytes as mentioned in the answer by Mikhail.

Here is some more insights.

Big Query stores every column in a separate encrypted, compressed file. So thus running a query like "SELECT *" will process much more bytes than a query that only SELECT's a few columns.

Upvotes: 0

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172944

If you query all fields in table of 2GB - you are charged for 2GB even if size of output just 10KB
Note: you are charged not for the whole table size but for the size of fields/columns you are query in that table (unless this is external table)

BigQuery charges for queries by using one metric: the number of bytes processed. You are charged for the number of bytes processed whether the data is stored in BigQuery or in an external data source such as Google Cloud Storage, Google Drive, or Google Cloud Bigtable.

More details in https://cloud.google.com/bigquery/pricing#queries

Upvotes: 3

Related Questions