Any access requests
The ACCESS access request element can be used to specify that the optimizer is to choose an appropriate method for accessing a table, based on cost, and must be used when referencing a derived table. A derived table is the result of another subselect. This access request element is defined by the complex type anyAccessType.
XML Schema
<xs:complexType name="anyAccessType">
<xs:complexContent>
<xs:extension base="extendedAccessType"/>
</xs:complexContent>
</xs:complexType>
Description
The complex type anyAccessType is a simple extension of the abstract type extendedAccessType. No new elements or attributes are added.
The TYPE attribute, whose only supported value is XMLINDEX, indicates to the optimizer that the table must be accessed using one of the XML index access methods, such as IXAND, IXOR, XANDOR, or XISCAN. If this attribute is not specified, the optimizer makes a cost-based decision when selecting an access plan for the specified table.
- An XISCAN plan using the specified index over XML data
- An XANDOR plan, such that the specified index over XML data is one of the indexes under XANDOR; the optimizer will use all applicable indexes over XML data in the XANDOR plan
- An IXAND plan, such that the specified index is the leading index of IXAND; the optimizer will add more indexes to the IXAND plan in a cost-based fashion
- A cost-based IXOR plan
- An XANDOR plan, such that the specified indexes over XML data appear under XANDOR; the optimizer will use all applicable indexes over XML data in the XANDOR plan
- An IXAND plan, such that the specified indexes are the indexes of IXAND, in the specified order
- A cost-based IXOR plan
- An XANDOR plan with all applicable indexes over XML data appearing under the XANDOR operator
- An IXAND plan with all applicable relational indexes and indexes over XML data appearing under the IXAND operator
- An IXOR plan
- An XISCAN plan if only a single index is defined on the table and that index is of type XML
Examples
<OPTGUIDELINES>
<HSJOIN>
<ACCESS TABLE='S1'/>
<IXSCAN TABLE='PS1'/>
</HSJOIN>
</OPTGUIDELINES>
SELECT * FROM security
WHERE XMLEXISTS('$SDOC/Security/SecurityInformation/
StockInformation[Industry= "OfficeSupplies"]')
<OPTGUIDELINES>
<ACCESS TABLE='SECURITY' TYPE='XMLINDEX'/>
</OPTGUIDELINES>
SELECT * FROM security
WHERE XMLEXISTS('$SDOC/Security/SecurityInformation/
StockInformation[Industry= "Software"]') AND
XMLEXISTS('$SDOC/Security/Symbol[.="IBM"]')
<OPTGUIDELINES>
<ACCESS TABLE='SECURITY' TYPE='XMLINDEX' ALLINDEXES='TRUE'/>
</OPTGUIDELINES>
- An XISCAN plan using the SEC_INDUSTRY XML index
- An IXAND plan with the SEC_INDUSTRY index as the first leg of the IXAND. The optimizer is free to use more relational or XML indexes in the IXAND plan following cost-based analysis. If a relational index were available on the TRANS_DATE column, for example, that index might appear as an additional leg of the IXAND if that were deemed to be beneficial by the optimizer.
- A XANDOR plan using the SEC_INDUSTRY index and other applicable XML indexes
SELECT * FROM security
WHERE trans_date = CURRENT DATE AND
XMLEXISTS('$SDOC/Security/SecurityInformation/
StockInformation[Industry= "Software"]') AND
XMLEXISTS('$SDOC/Security/Symbol[.="IBM"]')
<OPTGUIDELINES>
<ACCESS TABLE='SECURITY' TYPE='XMLINDEX' INDEX='SEC_INDUSTRY'/>
</OPTGUIDELINES>