Bigquery已解析与未解析的SQL

时间:2019-02-05 16:06:26

标签: google-bigquery

此处提到的已解析的和未解析的sql有什么区别:

https://cloud.google.com/bigquery/quotas#query_jobs

1 个答案:

答案 0 :(得分:2)

考虑此查询:

SELECT * FROM dataset.view1 JOIN dataset.view2 USING (key)

view1在哪里:

SELECT 1 AS key, 'foo' AS y;

view2是:

SELECT 1 AS key, 'bar' AS z;

在这种情况下,您可以将已解析的查询视为包含以下内容的JSON对象/原型消息:

{
  "query": "SELECT * FROM dataset.view1 JOIN dataset.view2 USING (key)"
  "views":
  [
    {
      "name": "view1",
      "sql": "SELECT 1 AS key, 'foo' AS y;"
    },
    {
      "name": "view2",
      "sql": "SELECT 1 AS key, 'bar' AS z;"
    }
  ]
}

因此,解析的查询长度是查询长度加上视图的总和。解析的查询长度限制足够高,通常与标准SQL查询无关。不过,对于旧版SQL查询,TABLE_DATE_RANGE之类的函数就像宏一样,可以将查询扩展为所有匹配表的并集,因此更容易获得较大的已解析查询大小。