Haipeng Su
Haipeng Su

Reputation: 2541

Get size_bytes for Query Results

I would like to get the size_bytes of a query result without saving the result to a table.
1. I noticed that we can use use

select size_bytes from [datasets__TABLES__]

to get the size of tables in a dataset.
2. what I am trying to do is kind of this,

select size_bytes from 
( some query )

Is that a way to do this? avoiding get the actual result, only get the byte size of the result?

Thank you.

Upvotes: 2

Views: 3831

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172994

to get size of result you actually need to generate result first! so, no, unfortunately - you cannot avoid getting actual result first

if you really want/need to avoid producing/paying for result - you can try to estimate result size based on original size of your data (see more here: Find out the amount of space each field takes in Google Big Query) and estimated number of rows in result

Upvotes: 1

Related Questions