Search This Blog

Friday, October 19, 2007

Update XML in DB2 9.5

This article discussed the W3C "XQuery Update Facility" specification
in the context of IBM DB2 9.5. The XQuery Update Facility extends the
XML Query language, XQuery. The XQuery Update Facility provides
expressions that can be used to make persistent changes to instances
of the XQuery 1.0 and XPath 2.0 Data Model. It provides facilities to
perform any or all of the following operations on an XDM instance:
insertion of a node, deletion of a node, modification of a node by
changing some of its properties while preserving its identity, and
creation of a modified copy of a node with a new identity. One of the
most significant new features in IBM DB2 9.5 for Linux, Unix and
Windows is the XML update functionality. The previous version, DB2 9,
introduced pureXML support for storing and indexing of XML data and
querying it with the SQL/XML and XQuery languages. Modifications to an
XML document were performed outside of the database server followed
by an update of the full document in DB2. Now DB2 9.5 introduces the
XQuery Update Facility, a standardized extension to XQuery that allows
you to modify, insert, or delete individual elements and attributes
within an XML document. This makes updating XML data easier and
provides higher performance. When DB2 9.5 executes the UPDATE statement,
it locates the relevant document(s) and modifies the specified elements
or attributes. This happens within the DB2 storage layer, that is the
document stays in DB2's internal hierarchical XML format the entire
time, without any parsing or serialization. Concurrency control and
logging happens on the level of full documents. Overall, this new
update process can often be 2x to 4x faster than the [DB2 9 pureXML]
process. This article describes how to perform such XML updates with
XQuery transform expressions. You'll see how to embed a transform in
UPDATE statements to permanently change data on disk, and in queries,
to modify XML data "on the fly" while reading it out without permanently
changing it. The latter can be useful if applications need to receive
an XML format that's different from the one in the database. More Information See also IBM Systems Journal: Click Here

No comments: