CREATE SELECTIVE XML 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 SELECTIVE XML INDEX index_name ON <table_object> (xml_column_name) [WITH XMLNAMESPACES (<xmlnamespace_list>)] FOR (<promoted_node_path_list>) [WITH (<index_options>)]
Work example
A workload needs indexed paths from a large XML column without indexing every node.
List the XQuery paths used by the workload and compare them with a primary XML index in a lab.
Check your work Every target path is covered and unrelated XML content remains outside the selective index.
Open Microsoft Learn for full syntax, permissions, and details for your version.