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 625757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:20:39+00:00 2026-05-13T19:20:39+00:00

I currently have a site with a table that has Lat/Long float columns, and

  • 0

I currently have a site with a table that has Lat/Long float columns, and an index over those 2 columns plus another one I need to retrieve.

I’m constantly querying this table to get the rows that fall within a radius from a certain point (I’m actually getting a square for speed), but I only need the fields that are already indexed, so this index is in fact covering, and the execution plan has only 2 steps:

Index Seek  (cost: 100%) and SELECT (cost: 0%)

Now, I’m trying to take advantage of the spatial features of SQL 2008. I’ve created the Geography column, filled it, created the spatial index, the works.

And it all works fine, except that the execution plan has a million steps, and 74% of the time is spent on a Clustered Index Seek, where it joins the rows it found in the Spatial Index to the actual table, to get the rest of the data…
(The Spatial Index Seek takes 1% of the Execution Plan Cost)

So, apparently, it IS using the Spatial index appropriately and finding the records I need much faster than before with my “regular” index over Lat/Long, but the joining to the main table is KILLING me, the Spatial query takes 7 times as long as my old one.

Is there any way to add more columns to the spatial index so that it’ll be covering and it can do things in one step, just like it was doing before?
Are there other things I could do to improve this situation?


UPDATE: I found that “regular” indexes can “include” other columns using the INCLUDE keyword (which I didn’t know about, I used to just include the columns in the index itself)
According to the documentation here, that clause is not an option for Spatial Indexes…
Any ideas?

Thanks!
Daniel

  • 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-13T19:20:40+00:00Added an answer on May 13, 2026 at 7:20 pm

    No, unfortunately there is currently no way to create a covering spatial index – the query will always do the bookmark lookup to the base table in order to get the geography value for the row.

    For STIntersects, this is clearly always required as we still need to perform the secondary filter on the actual geography object to verify that it actually intersects the parameter object. However, if you do not require exact answers and can use Filter(), then it would be possible to provide the primary key columns from the index without doing the lookup to the base table at all. Supporting this is something we are considering for the next release.

    In terms of speeding up your current query, have you tried using Filter() and tuning your index with the output from sp_help_geography_index?

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

Sidebar

Related Questions

I currently have a table that is 17 columns wide and has 30 records.
Currently I have a site where it has a header that looks something like
I have a mysql db table that has every U.S. city, state, zip, lat,
Currently I have a site that is set up using a masterpage and a
I currently have a web site hitting 7 Access DBs that I desperately need
I have a table with weekly data that looks like: userID Site date ------
I'm working on a web app that currently has a table-based layout. Ideally I'd
Currently I have a Rails 2.3 app that is a CMS serving over 100
I currently have a site which uses a MySQL 4.x schema, the site uses
I currently have a web site where users can select a custom theme. After

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.