google bigquery - Getting table-specific costs via SQL query -
is there query can run determine how queries against each table costing us? instance, result of query @ least include like:
dataset.table1 236tb processed dataset.table2 56gb processed dataset.table3 24kb processed etc
also there way know specific queries costing most?
thanks!
let's talk first data , respective data-points such query! take @ job resources
here have few useful properties
configuration.query.query - bigquery sql query execute.
statistics.query.referencedtables - referenced tables job.
statistics.query.totalbytesbilled - total bytes billed job. statistics.query.totalbytesprocessed - total bytes processed job.
statistics.query.billingtier - billing tier job.
having above data-points allow write relativelly simple query answer cost per query , cost per table questions!
so, - how data available? you can collect jobs using job.list api , loop thru available jobs , retrieve respective stats via job.get api - of course dumping retrieved data bigquery table. can enjoy analysis!
or can use bigquery's audit logs track access , cost details (as described in docs) , export them bigquery analysis.
the former option (jobs.list , job.get in loop)) gives ability jobs info if don't have audit logs enabled yet, because job.get api returns information specific job available 6 month period after creation - plenty of data analysis!
Comments
Post a Comment