Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

spatial join query is very slow - STContains(geometry::Point(long,lat,4283)

$
0
0

Hi Experts,

I have an update query as below.

ID columns are set as primary key. the SA3Dim table has spatial index on SP_Geometry field.

I forced the query to include the index. However, the query is very slow. To update a month data it takes over an hour and still running.

UPDATE SA3Table
SET [SA3_Name] = SA3Dim.[Sa3_name16]
FROM SA3Table AS main
Join LUTDataTable  as LUT on LUT.ID = main.ID
JOIN [dbo].[SA3Dim] AS Voronoi
WITH (INDEX (SIndex_SA3_Boundary_LatLong2_SP_GEOMETRY))
ON Voronoi.SP_GEOMETRY.STContains(geometry::Point(LUT.[PickupLongitude],LUT.[PickupLatitude],4283)) = 1 
WHERE (LUT.[PickupLongitude] IS NOT NULL AND LUT.[PickupLatitude] IS NOT NULL)

Any idea how to improve the performance of this query?

Appreciate any inputs here. Thanks in advance.


Viewing all articles
Browse latest Browse all 24688

Trending Articles