CREATE VECTOR 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 VECTOR INDEX index_name ON object ( vector_column ) [ WITH ( [ , ] METRIC = { 'cosine' | 'dot' | 'euclidean' } [ [ , ] TYPE = 'DiskANN' ] [ [ , ] MAXDOP = max_degree_of_parallelism ] ) ] [ ON { filegroup_name | "default" } ] [;]
Work example
A SQL Server 2025 vector workload needs indexed nearest-neighbor search.
Check engine version, vector dimensions, metric, index options, and recall target with representative synthetic vectors.
Check your work The index supports the selected metric and returns the expected nearest test vectors.
Open Microsoft Learn for full syntax, permissions, and details for your version.