簡體   English   中英

BigQuery - BI Engine 衡量節省

[英]BigQuery - BI Engine measuring savings

我已經在我的一個 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 進行完全加速查詢是否正常?
  1. 回答有關儲蓄計算的問題:
    我認為這是衡量節省的正確方法,但是一些QUERY類型的查詢不能用於 BI Engine,因此繼續計算它們有點不公平。
    這就是我在這個 SO 問題中編寫腳本的原因:
    BigQuery BI Engine:如何選擇合適的預留大小?
    您還可以通過如下計算改進將字節轉換為 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM