oso icon indicating copy to clipboard operation
oso copied to clipboard

Use bigquery usage statistics to measure costs

Open ravenac95 opened this issue 9 months ago • 0 comments

What is it?

We can better measure our usage of bigquery by making queries like this:

SELECT *
FROM `region-us`.INFORMATION_SCHEMA.JOBS_BY_PROJECT 
--`region-us` gets results for all jobs in the US region

This query allows us to track usage data for each of our queries. The schema is defined here. We should be able to determine the total bytes processed as actually see the most costly queries here. Additionally, each of the jobs listed has the user that executed the job as well as a plethora of other potentially useful information to understand the operation of each query.

To determine costs, we would simply need to multiply "bytes processed" by bigquery's pricing model.

ravenac95 avatar May 08 '24 19:05 ravenac95