BigQuery Deadline Exceeded和RuntimeException

时间:2016-05-09 22:00:31

标签: google-bigquery

当我运行查询时,我确信结果集不是那么大。我一直收到这个错误,有人可以解释导致此错误的原因以及如何更改我的查询以避免这种情况(除了选择较少的数据,因为这不是我能够为此查询更改的内容)

准备辅助查询时出错:com.google.storage.megastore.exception.DeadlineExceededRuntimeException:超出截止日期:截止日期

我的查询基本上是选择一个月的数据,然后应用case子句和group by。没有联接

这是我的查询的清理版本。大多数列只是字符串。

select
counted,
CONCAT(user_id,"_",string(index)) as user_id,
name,
-- We want to give each event an alias here, so the first event in the funnel would be called step1
case when name="16" and param7 = "b" then 'step1'
when name="71" then 'step2'
when name="73" then 'step3'
when name="10" and param7= "b" and param1="a" then 'step4'
when name="18" then 'step5'
when name="31" then 'step6'
else 'na'
end as step
from (TABLE_DATE_RANGE([tablename_],TIMESTAMP('2016-04-01'),TIMESTAMP('2016-05-01')))
-- selects all of the 6 steps in the funnel.
WHERE (name = "16" AND param7 = "b") OR (name = "71") OR (name = "73") OR (name="10" AND param7 = "b" AND  param1 = "a") OR (name = "18") OR (name = "31")

2 个答案:

答案 0 :(得分:1)

根据您的评论 - 您应该尝试

SELECT * FROM (
  SELECT
    counted,
    CONCAT(user_id,"_",STRING(index)) AS user_id,
    name,
    -- We want to give each event an alias here, so the first event in the funnel would be called step1
    CASE 
      WHEN name="16" AND param7 = "b" THEN 'step1'
      WHEN name="71" THEN 'step2'
      WHEN name="73" THEN 'step3'
      WHEN name="10" AND param7= "b" AND param1="a" THEN 'step4'
      WHEN name="18" THEN 'step5'
      WHEN name="31" THEN 'step6'
      ELSE 'na'
    END AS step
  FROM (TABLE_DATE_RANGE([tablename_],TIMESTAMP('2016-04-01'),TIMESTAMP('2016-05-01')))
)
-- leave only those 6 steps in the funnel.
WHERE step != 'na'

答案 1 :(得分:0)

同事提出的另一种可能性是我正在使用该功能 表日期范围会弄乱一些导致它失败的查询,他建议输入每个单独的表,所以在这种情况下30个表并且确实删除了错误,我注意到查询也更快。不确定为什么,并且查询一个巨大的查询是一件痛苦的事情,因为你要在FROM子句中查询每个日期必须有一行

FROM (TABLE_DATE_RANGE([tablename_],TIMESTAMP('2016-04-01'),TIMESTAMP('2016-05-01')))