Storage requirements for XML documents

The amount of space that an XML document occupies in a Db2® database is determined by the initial size of the document in raw form and by a number of other factors.

The following list includes the most important of these factors:

Document structure
XML documents that contain complex markup tagging require a larger amount of storage space than documents with simple markup. For example, an XML document that has many nested elements, each containing a small amount of text or having short attribute values, occupies more storage space than an XML document composed primarily of textual content.
Node names
The length of element names, attribute names, namespace prefixes and similar, non-content data also affect storage size. Any information unit of this type that exceeds 4 bytes in raw form is compressed for storage, resulting in comparatively greater storage efficiency for longer node names.
Ratio of attributes to elements
Typically, the more attributes that are used per element, the lower the amount of storage space that is required for the XML document.
Document codepage
XML documents with encoding that uses more than one byte per character occupy a larger amount storage space than documents using a single-byte character set.
Compression
If you enable data row compression for a table containing XML columns, XML documents will require less storage space.

Compression of data in the XML storage object of a table is not supported if the table contains XML columns using the Db2 Version 9.5 or earlier XML record format. If you enable such a table for data row compression, only the table row data in the table object is compressed. To make the data in the XML storage object of the table eligible for compression, use the ADMIN_MOVE_TABLE stored procedure to convert the table to the new format and then enable data row compression.