Search code examples
google-bigquery

In Google BigQuery, how to get storage size of a partition in time-partitioned table?


I can query for storage size of a table in BigQuery using SELECT size_bytes FROM dataset.__TABLES__ WHERE table_id='mytable', but this only works for finding total size of table. How to get size of a specific partition from a time-partitioned table, for example I want to find out how much data is stored in mytable$20180701.

I know I can for example copy that partition to a non-partitioned table and use the method above, but I feel this can't be the right method.


Solution

  • You can use dryRun for this - or in UI just type SELECT * FROM mytable$20180701 and see in Validator how much bytes will be processed - this is the size of the table