XML table space implicit creation

When you create an XML column in a table, Db2 implicitly creates an XML table space. Db2 also creates an XML table to store the XML data, and a node ID.

Each XML column has its own table space. The XML table space does not have limit keys. The XML data resides in the partition number that corresponds to the partition number of the base row. Tables that contain XML columns also have the following implicitly created objects:

  • A hidden column to store the document ID.

    The document ID is a Db2 generated value that uniquely identifies a row. The document ID is used to identify documents within the XML table. The document ID is common for all XML columns, and its value is unique within the table.

  • A unique index on the document ID (document ID index).

    The document ID index points to the base table RID. If the base table space is partitioned, the document ID index is a non-partitioned secondary index (NPSI).

  • The base table has an indicator column for each XML column containing a null bit, invalid bit, and a few reserved bytes.
Start of change The XML table space inherits several attributes from the base table space or the first logical partition of the base table space. The following table describes the inheritance of attributes. Attributes that are not listed use the default value or a value calculated for XML table spaces.
Attribute Attribute source
CLOSERULE Base table space
COMPRESS FL 509 Base table space, if available 1
DSSIZE Depends on the base table space type 2
FREEPAGE First logical partition of the base table space
GBPCACHE First logical partition of the base table space
LOCKMAX Base table space
LOG Base table space
MAXPARTITIONS Base table space 3
PAGENUM Base table space
PCTFREE First logical partition of the base table space
SEGSIZE Base table space
STORNAME First logical partition of the base table space
TRACKMOD First logical partition of the base table space
VCATNAME First logical partition of the base table space
Notes
  1. The attribute is available if the SYSTABLESPACE value for the base table space is NULL. If the attribute is not available, the XML table space inherits the attribute from the first logical partition of the base table space.
  2. The DSSIZE of the XML table space depends on the type of base table space:
    Base table space type DSSIZE of the XML table space
    Partition-by-growth UTS Inherited from base table space
    Partition-by-range (PBG) or partitioned (non-UTS) Calculated as described in the following table.
    Segmented (non-UTS) or simple 4 GB
    The following table shows the DSSIZE for an implicitly created XML table space for a base table in a partition-by-range (PBR) or range-partitioned (non-UTS) table space. For partition-by-range (PBR) table spaces with relative page numbering, Db2 also rounds the DSSIZE up to the nearest power of two before using the following table.
    Table 1. Default DSSIZE for XML table spaces, given the base table space DSSIZE and buffer-pool page size
    Base table space DSSIZE 4KB base page size 8KB base page size 16KB base page size 32KB base page size
    1–4 GB 4G B 4 GB 4 GB 4 GB
    5–8 GB 32 GB 16 GB 16 GB 16 GB
    9–16 GB 64 GB 32 GB 16 GB 16 GB
    17–32 GB 64 GB 64 GB 32 GB 16 GB
    33–64 GB 64 GB 64 GB 64 GB 32 GB
    65–128 GB 256 GB 256 GB 128 GB 64 GB
    129–256 GB 256 GB 256 GB 256 GB 128 GB
    257–512 GB 512 GB 512 GB 512 GB 256 GB
    513-1024 GB 1024 GB 1024 GB 1024 GB 512 GB
  3. If the base table resides in a segmented (non-UTS) or simple table space, the default value is used.
End of change

If an edit procedure is defined on the base table, the XML table inherits the edit procedure.

For more information see Storage structure for XML data.