首页 > 解决方案 > 雪花中的查询结果大小

问题描述

有没有办法知道 Snowflake 中的查询响应大小?

例如,在 BigQuery 中,我们从 BigQuery 在查询作业中创建的时态表中获取大小。

谢谢!

标签: snowflake-cloud-data-platform

解决方案


运行查询后,您始终可以参考其缓存结果。您只需要知道查询 id 并扫描其结果即可。然后,您可以通过选择测量大小的任何方法来确定这些结果的大小 - 例如,编码所有列的 json 的长度。

在代码中:

-- 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;


推荐阅读