从官方文档中,我们了解到LEFT / RIGHT / FULL OUTER JOINS没有针对空间数据进行优化。我一直在运行几个对GEOGRAPHY数据类型使用复杂联接的长查询。
我的问题是,BigQuery如何处理内部的空间数据联接?一切都转换为Geohash了吗?
我曾尝试按GEOGRAPHY类型列对表进行聚类,但到目前为止,速度的提高可忽略不计。
如果我在JOIN的where子句中使用Geohash(STRING)而不是GEOGRAPHY类型,是否会导致性能提升?
这是我正在谈论的示例:
select t1.Geohash, t1.Name, t1.Way, t1.Long, t1.Lat, t1.CoreInt
, t1.Label, t1.IntLat, t1.IntLong
, row_number() over(partition by Geohash order by Dist) as RowNum
, Distance
from table_name t1
left outer join (select Geohash, Label from table where CoreInt = 1) t2
using (Geohash)
where t2.Label is null
or t1.Label = t2.Label
Run Code Online (Sandbox Code Playgroud)
谢谢