简体   繁体   English

如何在不到一秒的时间内从 bigquery 表中获取单个行?

[英]How to get individual row from bigquery table less then a second?

I have a aggregated data.table in bigquery that has millions of rows.我在 bigquery 中有一个聚合的 data.table,它有数百万行。 This table is growing everyday.这张桌子每天都在增长。

I need a way to get 1 row from this aggregate table in milliseconds to append data in real time event.我需要一种方法在实时事件中以毫秒为单位从该聚合表中获取 1 行到 append 数据。

What is the best way to tackle this problem?解决这个问题的最佳方法是什么?

BigQuery is not build to respond in miliseconds, so you need an other solution in between. BigQuery 不是为以毫秒为单位响应而构建的,因此您需要介于两者之间的其他解决方案。 It is perfectly fine to use BigQuery to do the large aggregration calculation.大的聚合计算用BigQuery是完全没问题的。 But you should never serve directly from BQ where response time is an issue of miliseconds.但是你永远不应该直接从 BQ 服务,因为响应时间是毫秒级的问题。

Also be aware, that, if this is an web application for example, many reloads of a page, could cost you lots of money.. as you pay per Query.另请注意,如果这是一个 web 应用程序,则页面的多次重新加载可能会花费您很多钱……因为您需要为每个查询付费。

There are many architectual solution to fix such issues, but what you should use is hard to tell without any project context and objectives.有许多解决此类问题的架构解决方案,但如果没有任何项目上下文和目标,则很难说出您应该使用什么。

For realtime data we often use PubSub to connect somewhere in between, but that might be an issue if the (near) realtime demand is an aggregrate.对于实时数据,我们经常使用 PubSub 来连接两者之间的某个地方,但如果(近)实时需求是一个聚合,这可能是一个问题。

You could also use materialized views concept, by exporting the aggregrated data to a sub component.您还可以通过将聚合数据导出到子组件来使用物化视图概念。 For example cloud storage -> pubsub, or a SQL Instance / Memory store.. or any other kind of microservice.例如云存储 -> pubsub,或 SQL 实例/Memory 存储..或任何其他类型的微服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM