CREATE SPATIAL INDEX
defines an index; CREATE/ALTER REBUILD sorts and writes all rows of the key
What changes
- Input
- table or view columns (key, included, filter predicate)
- Output or change
- index structure (B-tree, columnstore, XML, spatial, JSON, vector, full-text)
Syntax at a glance
CREATE SPATIAL INDEX index_name ON <object> ( spatial_column_name ) { <geometry_tessellation> | <geography_tessellation> } [ ON { filegroup_name | "default" } ] [;]
Work example
A map or location query needs indexed spatial methods on a geometry or geography column.
Choose the tessellation settings from representative shapes and test the exact spatial predicates.
Check your work The index supports the target method and returns the same matches as the unindexed lab query.
Open Microsoft Learn for full syntax, permissions, and details for your version.