Spatial Indexing for Nearby Way SQL Server

85 views Asked by At

In my SQL Server database, I have a table Way with columns WayId (uniqueId) and LineObject (Created with expression Geography::STLineFromText('LINESTRING(long1 lat1, long2 lat12'))

I have to find out the nearby Way for one location of type geography, Created like 'POINT(Long Lat)'.

Is it possible to get performance improvement with spatial index? If so, please guide to achieve the same.

DECLARE @g geography = 'POINT(long lat)'

Select top 1 *
From Way
Order by LineObject.STDistance(@g)

Expected is performance improvement.

0

There are 0 answers