ALTER INDEX
changes 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
ALTER INDEX { index_name | ALL } ON <object> { REBUILD [ [ WITH ( <rebuild_index_option> [ , ...n ] ) ] | [ PARTITION = ALL [ WITH ( <rebuild_index_option> [ , ...n ] ) ] ] | [ PARTITION = partition_number [ WITH ( <single_partition_rebuild_index_option> [ , ...n ] ) ] ] ] | DISABLE | REORGANIZE [ PARTITION = partition_number ] [ WITH ( <reorganize_option> ) ] | SET ( <set_index_option> [ , ...n ] ) | RESUME [ ...
Work example
An index needs a targeted rebuild, reorganize, or option change from measured evidence.
Check fragmentation, page count, availability impact, log space, and the exact index name first.
Check your work The selected index reaches the requested state without blocking the workload beyond its window.
Open Microsoft Learn for full syntax, permissions, and details for your version.