Using optimization guidelines with XML data and XQuery expressions

Db2® optimization guidelines used in optimization profiles support XML data. You can create profiles that use guidelines to control the method of moving XML data in a partitioned database environment, the order of joins on XML data types, and the use of user-defined indexes over XML data

For information about using optimization profiles and guidelines see the related links at the end of this topic.

You can specify following types of optimizations in an optimization guideline for queries that access XML data or that use indexes over XML data:
  • Control how XML data is moved between partitions in a partitioned database environment using the DPFXMLMOVEMENT general request element.
  • Control the join order for joins on XML data types in plan optimization guidelines by setting the attribute FIRST to TRUE in access request elements or by using join request elements.
  • Control usage of indexes over XML data with access request elements:
    • Specify using a single XML index scan to access a table with the XISCAN access request element.
    • Specify using multiple XANDORed XML index scans to access a table with the XANDOR access request element.
    • Specify using multiple relational and XML index scans using the IXAND access request element with the TYPE attribute value set to XMLINDEX.
    • Specify having the Db2 optimizer perform a cost-based analysis and choose some XML index access to access a table using the ACCESS access request element and setting the attribute TYPE to XMLINDEX. For example, the optimizer can use an XML index access such as an XML index scan, XANDOR, or index ANDing with at least one XML index.
    • Specify using all the applicable relational indexes and indexes over XML data to access the specified table, regardless of cost, using the ACCESS access request element and setting the attributes TYPE to XMLINDEX and ALLINDEXES to TRUE.
    • Specify using all applicable relational indexes and indexes over XML data in an IXAND plan to access the specified table, regardless of cost, using the IXAND access request element and setting the attributes TYPE to XMLINDEX and ALLINDEXES to TRUE.