I've recently started seeing this weird behavior whereby doing a spatial search results in a degradated experience as I decrease my radius. I dropped and rebuilt my spatial index last night but the same weird result.
Any help would be appreciated.
Background:
Table size = ~360K rows
Table = {ID, Location (geography)}
E.g. Doing a query with Radius=20000 takes 1 sec but decreasing Radius=1000 is still executing after 3 minutes.
Query:
DECLARE @x geography
SET @x = geography::Point(47.5302778, -122.0313889, 4326)
SELECT TOP (25) L.RID, L.Location.STDistance(@x) AS DIST
FROM Location L
WHERE L.Location.STDistance(@x) <= @Radius
Index:
Right-clicking index gives me the following (I realize PAD-iNDEX isn't supported in SQL Azure, etc. but just copying verbatim what SQL Management Studio gives me)
CREATE SPATIAL INDEX [SPATIAL_Search_Location] ON [dbo].[Search]
(
[Location]
)USING GEOGRAPHY_GRID
WITH (
GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM),
CELLS_PER_OBJECT = 16, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)