XML indexing consists of two categories: primary and secondary indexes. These two indexes types provide an indexing relationship within the XML documents similar to the relationship between clustered and non-clustered indexes. When implementing XML indexes, there are some basic rules that apply to each.
1.Primary XML indexes include paths, tags, and values of the XML content.
2.Primary XML indexes cannot exist without a clustered index on the primary key of the table that the XML column is in. This clustered index is required for partitioning the table, and the XML index can use the same partitioning scheme and functioning.
3.A secondary XML index extends the primary index including paths, values, and properties.
4.A secondary XML index cannot exist without a primary XML index
Basicly, the step is followed:
Collection - Table - Primary Index - Second Index (either path, value or property or both or all)
需要注意的是
Follow the basic rules of PATH being utilized for knowing the path in which the query requires, PROPERTY for searching proeprty values and PATH possibly being unknown, and VALUE based on exact value searches in queries.
Secondary indexes provide a lot of benefit when there are multiple unique values in the XML content. In many cases cases, though, a primary XML index will be sufficient. There are a number of other things to keep in mind when building secondary XML indexes. First, creating XML indexes takes a large amount of storage. Also, think about nodes and paths to indexes based on queries that will be encountered in the system. Strive to strike a balance between hardware resources, storage, index usefulness, amount of indexes created, and the number of times an index may actually be needed when building XML indexes.