XML index scan access requests
The XISCAN access request element can be used to specify that the optimizer is to use an index over XML data scan to access a local table. It is defined by the complex type indexScanType.
XML Schema <xs:complexType name="indexScanType"> <xs:complexContent> <xs:extension base="accessType"/> <xs:attribute name="INDEX" type="xs:string" use="optional"/> </xs:extension> </xs:complexContent> </xs:complexType>
The complex type indexScanType extends the abstract accessType by adding an optional INDEX attribute. The INDEX attribute specifies the name of the index over XML data that is to be used to access the table.
- If the index over XML data scan access method is not in the search space that is in effect for the statement, the access request is ignored and SQL0437W with reason code 13 is returned.
- If the INDEX attribute is specified, it must identify an index over XML data defined on the table that is identified by the TABLE or TABID attribute. If the index does not exist, the access request is ignored and SQL0437W with reason code 13 is returned.
- If the INDEX attribute is not specified, the optimizer chooses an index over XML data in a cost-based fashion. If no indexes over XML data are defined on the target table, the access request is ignored and SQL0437W with reason code 13 is returned.
Given the following query:
The following XISCAN guideline specifies that the SECURITY table should be accessed using an XML index named SEC_INDUSTRY.
SELECT * FROM security WHERE XMLEXISTS('$SDOC/Security/SecurityInformation/ StockInformation[Industry = "OfficeSupplies"]')
<OPTGUIDELINES> <XISCAN TABLE='SECURITY' INDEX='SEC_INDUSTRY'/> </OPTGUIDELINES>