For an introduction to spatial indexing in SQL Server, see Spatial Indexing Overview.
Every option can be specified only once per CREATE SPATIAL INDEX statement. Specifying a duplicate of any option raises an error.
You can create up to 249 spatial indexes on each spatial column in a table. Creating more than one spatial index on specific spatial column can be useful, for example, to index different tessellation parameters in a single column.
An index build cannot make use of available process parallelism.
Methods Supported on Spatial Indexes
Spatial Indexes and Partitioning
By default, if a spatial index is created on a partitioned table, the index is partitioned according to the partition scheme of the table. This assures that index data and the related row are stored in the same partition.
In this case, to alter the partition scheme of the base table, you would have to drop the spatial index before you can repartition the base table. To avoid this restriction, when you are creating a spatial index, you can specify the "ON filegroup" option. For more information, see "Spatial Indexes and Filegroups," later in this topic.
Spatial Indexes and Filegroups
By default, spatial indexes are partitioned to the same filegroups as the table on which the index is specified. This can be overridden by using the filegroup specification:
[ ON { filegroup_name | "default" } ]
If you specify a filegroup for a spatial index, the index is placed on that filegroup, regardless of the partitioning scheme of the table.
Catalog Views for Spatial Indexes
The following catalog views are specific to spatial indexes:
-
sys.spatial_indexes
-
Represents the main index information of the spatial indexes.
-
sys.spatial_index_tessellations
-
Represents the information about the tessellation scheme and parameters of each of the spatial indexes.
For information about the metadata structure of spatial indexes, see Internal Tables.
Additional Remarks About Creating Indexes