XML data and query performance

XML data is more expensive to process, and might affect the performance of most SQL statements. Each row of an XML column contains an XML document, requires more processing, and requires more space in DB2®.

Begin program-specific programming interface information.
When you use an XQuery or XPath expression to search or extract the XML data, you can lessen the performance impact by avoiding the descendant or descendant-or-self axis in the expression. The XMLEXISTS predicate is always stage 2. However, you can use the XML index to reduce the number of rows, that is, the number of XML documents, that must be searched at the second stage.

Creating and maintaining XML indexes might be more costly than non-XML indexes. Write queries to use non-XML indexes to filter as many rows as possible before the second stage.

End program-specific programming interface information.