Derek Hu
Derek Hu

Reputation: 11

Is there any way to get the size in bytes of each database of a Bigquery project?

I am trying to run a script in bigquery where I find the size of all databases in a given project.

Upvotes: 1

Views: 268

Answers (1)

Jaytiger
Jaytiger

Reputation: 12254

Consider INFORMATION_SCHEMA.TABLE_STORAGE view.

SELECT project_id, table_schema, SUM(total_logical_bytes) AS total_logical_bytes
  FROM `region-asia-northeast3`.INFORMATION_SCHEMA.TABLE_STORAGE
 GROUP BY 1, 2 ORDER BY 3 DESC
;

output:

enter image description here

Upvotes: 2

Related Questions