sql server - Spatial index not helping SQL Query (very slow performance) -


i'm trying test performance of spatial indexes on latitude/longitude values in table of 1.7 million postcodes. i've created geography column , added index it, query using spatial index dramatically (at least 100x) slower 1 using 'normal' index on lat/long columns in same table, yet query plan shows index being used.

here query:

declare @point geography set @point = geography::stgeomfromtext('point(-1.31548 51.06390)', 4326)  select postcode , location.stdistance(@point) dist dbo.postcodes with(index(ix_postcodes_spatialindex)) location.stintersects(@point.stbuffer(200)) = 1    order location.stdistance(@point) 

how can go debugging what's happening here?

edit: accepted of defaults when creating index:

create spatial index [ix_postcodes_spatialindex] on [dbo].[postcodes] (location) using geography_auto_grid on [primary]

query plan: (you may need zoom in ;)

enter image description here


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -