日表与时间分区上的通配符 [英] Wilcard on day table vs time partition

查看:25
本文介绍了日表与时间分区上的通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解以下之间的大查询(例如在成本或请求的可能性方面)是否存在差异:

I try to understand if there is a difference in big query (in the cost or possibility of requesting for example) between :

  • 每天创建一张表(如 my_table_2018_02_06)
  • 创建一个时间分区表(my-table with time partition by day).

谢谢!

推荐答案

简短说明:当 BigQuery 没有可用的分区机制时,建议使用通配符表查询多个表.自然演变是包括分区表的功能,目前有一个包含基于列的时间分区的 alpha 版本,即让用户定义哪一列(具有 DATETIMESTAMP 数据类型)将用于分区.

Short explanation: querying multiple tables using Wildcard Tables was the proposed alternative for when BigQuery did not have a partition mechanism available. The natural evolution was to include the feature of Partitioned Table, and currently there is an alpha release consisting in column-based time partitioning, i.e. letting the user define which column (having a DATE or TIMESTAMP data type) will be used for the partitioning.

因此,目前 BigQuery 工程师正在努力为表分区添加更多新功能,而不是传统的通配符表方法,那么我建议您使用它们.

So currently BigQuery engineers are working in adding more new features to table partitioning, instead of the legacy Wildcard Tables methodology, then I'd suggest that you work with them.

详细解释:您正在比较两种实际上用于相同目的但具有不同含义的方法:

Long explanation: you are comparing two approaches that in fact are used with the same purpose, but which have different implications:

  • 通配符表: 前一段时间,当 Big Query 不支持表分区功能时,通配符表是使用简洁的 SQL 查询来查询多个表的方法.通配符表表示与 SQL 语句中指定的通配符表达式匹配的所有表的联合.但是,通配符表有一些限制,例如:
    • 不支持视图.
    • 不支持缓存结果(包含通配符表的查询在每次运行时都要收费,即使选中了缓存结果"选项).
    • 仅适用于本机 BigQuery 存储(不能使用外部表 [Bigtable、Storage 或 Drive]).
    • 仅在标准 SQL 中可用.
    • 每个分区表最多 2500 个分区.
    • 每个表每天最多 2000 次分区更新.
    • 每 10 秒最多更新 50 个分区.

    因此,一般而言,建议使用通配符表在多个表上使用分区表.但是,您应该始终考虑您的用例,看看哪种可能性更符合您的要求.

    So in general, it would be advisable to work with Partitioned Tables over multiple tables using Wildcard Tables. However, you should always consider your use case and see which one of the possibilities meets your requirements better.

    这篇关于日表与时间分区上的通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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