Spatial Database – Understanding Basics about Spatial Indexes

databasespatial-databasespatial-index

I was asking on a forum if it could be a good idea to create spatial indexes on subsets of a table when your application display on map only those subsets and never the entire table.

I was asking this question because I though that as the subsets do not have the same extents of the whole table, maybe it would be faster to display the subsets with their own spatial indexes.

The answer I received was that spatial indexes do not affect display time but only used for spatial queries such union or intersect. Is it true??? My experience with GIS and database is when a table has no spatial index, the display on map is much slower. I always thought that on display the table was queried to show the features that intersect the current map window extent, so the features outside are not loaded for nothing. Is it really how it works? This is a kind of spatial query no?

What is the truth? Is it a good idea to create spatial indexes on subsets?

Best Answer

For displaying purposes it is always good to use a spatial index. It will improve speed of both rendering and spatial queries. However, if you plan to update large quantities of objects, it might be wise to remove the spatial index during the update. Otherwise the update process will become significantly slower, because with every update the spatial index needs to be updated as well. After updating you can add a spatial index again.

Related Question