BigQuery 日期分区视图 [英] BigQuery Date-Partitioned Views

查看:23
本文介绍了BigQuery 日期分区视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

BigQuery 允许您创建日期分区表:https://cloud.google.com/bigquery/docs/creating-partitioned-tables

BigQuery allows you to create date-partitioned tables: https://cloud.google.com/bigquery/docs/creating-partitioned-tables

我希望能够在日期分区表的顶部创建视图,并且理想情况下仍然可以获得性能优势.我读过的所有内容都表明这是不可能的?

I'd like to be able to create views on top of date-partitioned tables and ideally still reap the performance benefits. Everything I've read suggests that this isn't possible?

有没有人有其他运气?

推荐答案

定义您的视图以公开分区伪列,如下所示:

Define your view to expose the partitioning pseudocolumn, like this:

SELECT *, EXTRACT(DATE FROM _PARTITIONTIME) AS date
FROM Date partitioned table;

现在,如果您在 date 上使用过滤器查询视图,它将限制读取的分区.

Now if you query the view using a filter on date, it will restrict the partitions that are read.

这篇关于BigQuery 日期分区视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆