From the official docs we read that LEFT/RIGHT/FULL OUTER JOINS are not optimized for spatial data. I have been running several long queries that use complex joins on GEOGRAPHY
data types.
My question is, how does BigQuery deal with spatial data join under the hood? Is everything converted to Geohash?
I have tried clustering my table by a GEOGRAPHY
type column but so far speed improvements have been negligible.
If I use Geohash (STRING) in a where clause for a JOIN instead of a GEOGRAPHY
type does that result in a performance boost?
Here's an example of what I'm talking about:
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
Thanks