【问题标题】:BigQuery - BI Engine measuring savingsBigQuery - BI Engine 衡量节省
【发布时间】:2022-12-10 23:41:34
【问题描述】:

我已经在我的一个 Google 项目中部署了 BI 引擎,我正在使用以下查询来衡量成本节省

with tbl
as
(
    select creation_time, total_bytes_processed, total_bytes_billed,    
           5 * (total_bytes_processed / 1000000000000) as cost_projected, 
           5 * (total_bytes_billed / 1000000000000) as cost_actual

      from `region-us`.INFORMATION_SCHEMA.JOBS_BY_PROJECT b
     where 1=1
       and job_type = "QUERY"
       and creation_time >= '2022-05-10 11:30:00.000 UTC'
       and creation_time <= '2022-05-10 19:00:00.000 UTC'
)
select sum(cost_projected) - sum(cost_actual) as savings
  from tbl
 where 1=1
;

但是,我注意到我经常加速查询 (bi_engine_statistics.bi_engine_mode = 'FULL'),其中 'total_bytes_billed = total_bytes_processed'。我期望对于加速查询 total_bytes_billed 应该等于零,但似乎并非如此。

所以问题是:

  1. 我的查询是衡量储蓄的正确方法吗?
  2. 使用 total_bytes_billed > 0 进行完全加速查询是否正常?

【问题讨论】:

    标签: google-bigquery gcloud google-bi-engine


    【解决方案1】:
    1. 回答您的问题储蓄计算:
      我认为这是衡量节省的正确方法,但某些 QUERY 类型的查询不能用于 BI 引擎,因此继续计算它们有点不公平。
      这就是我在这个 SO 问题中编写脚本的原因:
      BigQuery BI Engine: how to choose a good reservation size?
      您还可以通过如下计算改进将字节转换为 TB:
      sum(total_bytes_processed) / pow(1024, 4) AS TB_processed
      1. 至于你的关于 FULL 模式的问题,仍然需要付费:
        我已经打开 BI 引擎,如果我对我的数据运行这个查询,我得到 0 个结果,所以我所有的 bi_engine_mode='FULL' 查询都节省了:
      SELECT 
          total_bytes_processed, 
          total_bytes_billed, 
          bi_engine_statistics
      FROM `my_project_id.region-eu.INFORMATION_SCHEMA.JOBS`
      WHERE 1=1
          and bi_engine_statistics.bi_engine_mode = 'FULL'
          and total_bytes_processed = total_bytes_billed
          and total_bytes_processed > 0
      

    【讨论】:

      猜你喜欢
      • 2022-12-09
      • 2020-02-13
      • 1970-01-01
      • 1970-01-01
      • 2020-06-04
      • 1970-01-01
      • 2019-07-02
      • 1970-01-01
      • 2018-01-10
      相关资源
      最近更新 更多