SQL Flow Field Guide

CREATE XML INDEX (Selective XML Indexes)

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

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 XML INDEX index_name ON <table_object> ( xml_column_name ) USING XML INDEX sxi_index_name FOR ( <xquery_or_sql_values_path> ) [WITH ( <index_options> )]

Work example

A workload needs only selected paths from an XML column indexed.

List XQuery paths from the application and compare their mappings with a full XML index in a lab.

Check your work Each mapped path is searchable and an unlisted path does not rely on the selective index.

Open Microsoft Learn for full syntax, permissions, and details for your version.