Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3423796
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:23:52+00:00 2026-05-18T06:23:52+00:00

I have a column of type geography. I have created a a spatial index,

  • 0

I have a column of type geography. I have created a a spatial index, but its not being used:

declare @geog geography 
select @geog = 'POINT (18.12 -33.2)' 

select  *
from  dbo.product  WITH(INDEX(IX_Spatial))  
where 
@geog.STDistance(GeoLocation) > 1000

The index is created like this:

 CREATE SPATIAL INDEX [IX_Spatial] ON [dbo].[Product] 
(
 [GeoLocation]
)USING  GEOGRAPHY_GRID 
WITH (
GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM), 
CELLS_PER_OBJECT = 1024, 
PAD_INDEX  = OFF, SORT_IN_TEMPDB = OFF, 
DROP_EXISTING = OFF, ALLOW_ROW_LOCKS  = ON, 
ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO

The values for grid density at the various levels are for not deliberately set to medium. It makes no difference what I set them to, If I view the estimated execution plan, the index is not used.

[http://blogs.msdn.com/b/isaac/archive/2008/08/29/is-my-spatial-index-being-used.aspx][1]

If I try to add a hint to the query optimizer

declare @geog geography 
select @geog = 'POINT (18.12 -33.2)' 

select  *
from  dbo.product  WITH(INDEX(IX_Spatial))  
where 
@geog.STDistance(GeoLocation) > 1000

I get this error:

The query processor could not produce
a query plan for a query with a
spatial index hint. Reason: Spatial
indexes do not support the comparator
supplied in the predicate

My database is running at SQL Server 2008 (100) compatibility level.

.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:23:52+00:00Added an answer on May 18, 2026 at 6:23 am

    SQL Server creates spatial indexes in the following way: it splits the whole map into several rectangles (tiles) and indexes the number of each tile.

    For any given point, it is possible to calculate the numbers of rectangles within a distance but not out of the distance (there can be infinitely many).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, I have created a table called Placemarks containing a column of type 'geography'.
I have an SQL Server 2008 database with a column of type geography storing
i created a FTS by this article i have a column with type of
I have type column in my table, type column value is HOT and NOT
I have a column model like that: ... {name:'password',index:'password', width:100}, {name:'type.name',index:'type.name', width:100}, ... My
Does Oracle have an equivalent column type to MySQL's TEXT type? If not, how
I have some form, and one column have Entity type, but this entity have
I have a column in my database of data type Geography which I want
I have a column of type object in a model. But if I load
I have a column type money in my sql server database, which is moneyAcumulated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.