Bigquery每次搜索有限的记录

时间:2018-01-26 00:35:01

标签: pagination google-bigquery

我在bigquery下运行查询:

urlencode($contRow['cont_file'])

但是,大查询仍在处理中。有没有办法将查询和请求分页到每个FETCH NEXT 10 ROWS SELECT othermovie1.title, (SUM(mymovie.rating*othermovie.rating) - (SUM(mymovie.rating) * SUM(othermovie.rating)) / COUNT(*)) / (SQRT((SUM(POW(mymovie.rating,2)) - POW(SUM(mymovie.rating),2) / COUNT(*)) * (SUM(POW(othermovie.rating,2)) - POW(SUM(othermovie.rating),2) / COUNT(*) ))) AS num_density FROM [CFDB.CF] AS mymovie JOIN [CFDB.CF] AS othermovie ON mymovie.userId = othermovie.userId JOIN [CFDB.CF] AS othermovie1 ON othermovie.title = othermovie1.title JOIN [CFDB.CF] AS mymovie1 ON mymovie1.userId = othermovie1.userId WHERE othermovie1.title != mymovie.title AND mymovie.title = 'Truth About Cats & Dogs, The (1996)' GROUP BY othermovie1.title

1 个答案:

答案 0 :(得分:1)

您不会在BigQuery中找到与分页结果相关的任何概念,以提高处理性能。

尽管如此,你可以做几件事情来理解为什么这么长时间以及如何改进它。

对于初学者,我建议使用Standard SQL代替Legacy,因为前者能够执行多项优化计划,可能会帮助您(例如pushing down filters)在加入之前而不是之后发生,如果您使用的是Legacy,则属于您的情况。

您还可以使用query plans explanation更有效地诊断查询瓶颈的位置;最后,请务必遵循best practices中讨论的概念,它可能会帮助您调整查询以提高性能。