snowflake-cloud-data-platform - 雪花中的查询结果大小
问题描述
有没有办法知道 Snowflake 中的查询响应大小?
例如,在 BigQuery 中,我们从 BigQuery 在查询作业中创建的时态表中获取大小。
谢谢!
解决方案
运行查询后,您始终可以参考其缓存结果。您只需要知道查询 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;
推荐阅读
- android - 使用 Koin 注入共享 ViewModel
- r - R中的日期转换格式
- swiftui - 如何使视图始终可编辑(允许删除和移动行)而无需使用编辑按钮?
- c# - NUnit 3 测试监听器
- python - 使用 matplotlib python 绘制图形
- java - 从 Java 编辑 .jsp 文件 - Tomcat websocket
- fortran - 数据类型的 Fortran 警告
- search - 仅通过运行 podman 和 skopeo 工具知道映像名称和注册表 url 时,如何在注册表中找到 docker 映像?
- python - 将图形的 x 轴标签从 Daily 更改为 Yearly
- javascript - 在添加事件时捕获变量值