I want to learn how to use Spatial Index in SQL SERVER 2012. I have some very time-consuming query so I need it.
I would be very grateful for some example and explanation.
Thanks!
I presented a session at the SQLBits conference a while ago that you might find helpful. You can still view the video and slidedeck online at: http://sqlbits.com/Sessions/Event5/Creating_High_Performance_Spatial_Databases
In a nutshell:
There are several spatial-index specific settings that can affect the performance of the primary filter. To start with, I'd recommend that you stick to the default, which is MEDIUM resolution at all four levels of grids, and 16 cells per object. If you're using the geometry datatype, make sure you set a BOUNDING_BOX that encompasses the whole of your dataset (for geography, spatial indexes always cover the entire globe so this is not necessary). Then, try tweaking one setting at a time and measure the performance increase/decrease.
<plug>There's a chapter dedicated to spatial indexing and improving performance of spatial queries in the upcoming "Pro Spatial with SQL Server 2012"</plug> - http://www.amazon.com/Pro-Spatial-SQL-Server-2012/dp/1430234911/ref=sr_1_3?ie=UTF8&qid=1334310547&sr=8-3 (full disclaimer - I'm the author)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With