Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query result size in snowflake

Is there a way to know the query response size in Snowflake?

For example, in BigQuery we get the size from the temporal table created by BigQuery in a query job.

Thanks!

like image 375
oleurud Avatar asked Oct 21 '25 04:10

oleurud


1 Answers

After you run a query you can always refer back to its cached results. All you need to know is the query id and scan for its results. Then you can determine the size of those results by whatever method you choose to measure the size - for example, the length of json encoding all columns.

In code:

-- run a query then get its id

set last_query_id = (select last_query_id());

select sum(length(to_json(object_construct(a.*)))) table_encoded_size
from table(result_scan($last_query_id)) a;

like image 106
Felipe Hoffa Avatar answered Oct 24 '25 06:10

Felipe Hoffa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!